This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Tomcat and the fly likes Deploying a web-application within an application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Deploying a web-application within an application" Watch "Deploying a web-application within an application" New topic
Author

Deploying a web-application within an application

Dhaval J. Patel
Ranch Hand

Joined: Mar 10, 2011
Posts: 90

Hello everyone..
I have a web application that is running .. lets say the url is www.submission.com/submit . I have a saperately developed web app that I would like to deploy at the location www.submission.com/submit/test.
How can I do this ?? Can I put the war file of the new application in the lib folder of the existing application and configure the web.xml to call that web application for that url pattern ?? I am not sure .. Just speculating ..
Please help

Thanks in advance
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15964
    
  19

No, you cannot place a WAR within a WAR. Each WAR is a stand-alone entity and its structure is defined by the J2EE spec - which among other things says that certain files and directories must be located at certain absolute places within the WAR file. Exploding the WAR file into a physical disk directory tree doesn't change that.

But what you really want is to provide 2 different contexts, where one context path is and extended version of the other context path. Since each context can locate its WAR anywhere it wants, actual physical embedding of a WAR isn't required.

The real question is "can Tomcat be directed to match first against a longer context path, then fall back to a shorter path if the longer match fails?". I don't know. It might even do that by default, although I'd have to RTFM, or maybe even the source code.

Assuming it doesn't, however, an alternative would be to employ a URL rewriting scheme so that, for example www.submission.com/submit/test remaps to www.submission.com/test and www.submission.com/submit (without the "/test") passes through unchanged.


Customer surveys are for companies who didn't pay proper attention to begin with.
Dhaval J. Patel
Ranch Hand

Joined: Mar 10, 2011
Posts: 90

Thanks for the reply,
I'd go with the URL rewriting method. Should work fine
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Deploying a web-application within an application
 
Similar Threads
access one EAR from another EAR
HTTP Request
How are apps selling in the Google store
Making J2ME app delivery easier
Passing objects via form submit