Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Servlet mapping before context root is this possible ?  RSS feed

 
Frank Jacobsen
Ranch Hand
Posts: 358
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have this mapping:

<servlet>
<servlet-name>wsdl</servlet-name>
<jsp-file>/wsdl/bankconnect.html</jsp-file>
</servlet>
<servlet-mapping>
<servlet-name>wsdl</servlet-name>
<url-pattern>/wsdl</url-pattern>
</servlet-mapping>

And this works fine:

http://bdaix416.bdunet.dk:9080/bankconnect/wsdl

The war file is deployed under the context root /bankconnect/

I want to make a servlet mapping, before the context root "i still want the context root bankconnect".

http://bdaix416.bdunet.dk:9080/wsdl is this possible ? and if , how to ?

Frank



 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to deploy it as the ROOT web app, instead of as "bankconnect".
 
Frank Jacobsen
Ranch Hand
Posts: 358
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That means i have to deply the war file 2 times ?

Becouse i still want that the webservice is under "bankconnect" or ?
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, you'd deploy it once as ROOT. You wouldn't deploy it as "bankconnect".

If you want some of the URLs still to start with "bankconnect", then you can create those URLs inside of the ROOT web app (this involves some restructuring of the web app, but nothing major).
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The context part of the URL is handled by the application server. When a URL request comes in to the server, it parses the URL and uses the context path to determine which of possibly many web applications (WARs) deployed within the server should recieve the incoming request and passes that request to the corresponding webapp (simplified explanation).

There must be a 1-to-1 correspondence between webapp context paths and their corresponding webapp, so making a single webapp appear at "/" and at "/bankconnect" isn't possible.

There are 2 ways to emulate such behaviour, however.

One, already mentioned, is to not consider "/bankconnect" to be a context path at all, just a sub-path of the root context, then deploy the webapp as the root webapp.

The other is to use URL rewriting to recast the desired URLs to a common context. If you are fronting the JEE appserver with a proxy server such as Apache, then the proxy can handle the rewriting (Apache's mod_rewrite, for example). If you are not - then you have to persuade the appserver's URL dispatcher to rewrite the URL before dispatching it. This is a vendor-specific solution. For the Tomcat webapp server, a Catalina Valve would handle that.
 
Frank Jacobsen
Ranch Hand
Posts: 358
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your answers, that helps me a lot

Frank
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!