• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Deploying a web-application within an application

 
Dhaval J. Patel
Ranch Hand
Posts: 90
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 18099
51
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Dhaval J. Patel
Ranch Hand
Posts: 90
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply,
I'd go with the URL rewriting method. Should work fine
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic