DWR and absolute URL

View: New views
1 Messages — Rating Filter:   Alert me  

DWR and absolute URL

by Yevgen Lisin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

DWR and absolute URL

I have following situation:
My application server placed behind the proxy server (Apache). And proxy server change the context root.
For example:
Application root is R1. So, to connect to the application I have to use the url like this:
http://server:port/R1. But the server itself is behind the firewall. To access the server proxy is used.

And the proxy change the root following way: http://proxyserver/a/R1
The class InterfaceHandler has the row: String path = request.getContextPath() + request.getServletPath(); Because of it the DWR can't handle the described situation correctly.

I was trying to modify the code : String path = request.getServletPath().substring(1); (use relative path)
It works, but leads to an additional problem with servlet mapping.
In this case for each application subfolder (where DWR is used) I have to add additional servlet-mapping entry. Like:
<servlet-mapping>
<servlet-name>dwr-invoker</servlet-name>
<url-pattern>/dwr/*</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>dwr-invoker</servlet-name>
<url-pattern>/a/b/dwr/*</url-pattern>
</servlet-mapping>


I think the solution can be following: instead of using mapping based on the folder path to use mapping based on extension path:

<servlet-mapping>
<servlet-name>dwr-invoker</servlet-name>
<url-pattern>*.dwr</url-pattern>
</servlet-mapping>

This type of J2EE mapping allow to be independent from URL path. Also, "import" JavaScript URL synatx should be changed. For example:

<script type="text/javascript" src='dwr.dwr?script=ECSCCUserExtLookupChoise.js'></script>
Of course, code modification is required.
Sorry, if I am wrong or this is known issue.


Yevgen Lisin



Yevgen Lisin
Ext 4159