• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Servlet mapping before context root is this possible ?

 
Ranch Hand
Posts: 378
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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



 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You need to deploy it as the ROOT web app, instead of as "bankconnect".
 
Frank Jacobsen
Ranch Hand
Posts: 378
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).
 
Saloon Keeper
Posts: 27807
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 378
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your answers, that helps me a lot

Frank
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic