You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jon Kristensen <in...@jonkristensen.com> on 2010/04/29 16:13:50 UTC

Adding or Mount a Sub-Context or Archive to a Path

Hello people!

I'm using Apache 2.2.9, Tomcat 6.0.26, and mod_jk. I'm forwarding all
requests from Apache to Tomcat. My Tomcat configuration looks like this:

<Host name="jon3d.org"  appBase="webapps" unpackWARs="false"
autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
        <Context path="" docBase="jon3d-website-0.0.1.0-SNAPSHOT.war"
allowLinking="true"></Context>
        <Alias>www.jon3d.org</Alias>
</Host>

Now, I want to be able to attach (static) content from a WAR, or even
better, a ZIP file, to a subdirectory, like http://jon3d.org/WebStart. I
would prefer not to have to extract the war file for ease of deployment
and to not having to redo anything when deploying a new site WAR file. I
want to be able to mount a variable amount of such archives to different
directories.

I've been looking at haveing context configuration files within the
archive but I don't want the main project to be aware of these mounts
(as they must be able to change over time without redeployment) and
since a mount should not be aware of other mounts.

Let me know if I should clarify something!

Thanks!

Warm Regards,
Jon Kristensen



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Adding or Mount a Sub-Context or Archive to a Path

Posted by Jon Kristensen <in...@jonkristensen.com>.
On Thu, 2010-04-29 at 10:49 -0500, Caldarale, Charles R wrote:
> > From: Jon Kristensen [mailto:info@jonkristensen.com]
> > Subject: RE: Adding or Mount a Sub-Context or Archive to a Path
> > 
> > > > I'm forwarding all requests from Apache to Tomcat.
> > >
> > I have other pages requiring httpd.
> 
> Please reconcile the above two statements.

I meant to say that I'm forwarding all requests on this specific host to
Tomcat.

> > What if I want to deploy other sites to the server?
> 
> The term "sites" is not used with a servlet container environment.  Assuming you are referring to having multiple <Host> elements, used a different appBase for each.  The doc is here:
> 
> http://tomcat.apache.org/tomcat-6.0-doc/virtual-hosting-howto.html
> 
>  - Chuck

I see! Thanks!

-- 
Jon Kristensen <in...@jonkristensen.com>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Adding or Mount a Sub-Context or Archive to a Path

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Jon Kristensen [mailto:info@jonkristensen.com]
> Subject: RE: Adding or Mount a Sub-Context or Archive to a Path
> 
> > > I'm forwarding all requests from Apache to Tomcat.
> >
> I have other pages requiring httpd.

Please reconcile the above two statements.

> What if I want to deploy other sites to the server?

The term "sites" is not used with a servlet container environment.  Assuming you are referring to having multiple <Host> elements, used a different appBase for each.  The doc is here:

http://tomcat.apache.org/tomcat-6.0-doc/virtual-hosting-howto.html

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


RE: Adding or Mount a Sub-Context or Archive to a Path

Posted by Jon Kristensen <in...@jonkristensen.com>.
On Thu, 2010-04-29 at 09:30 -0500, Caldarale, Charles R wrote:
> > From: Jon Kristensen [mailto:info@jonkristensen.com]
> > Subject: Adding or Mount a Sub-Context or Archive to a Path
> > 
> > I'm using Apache 2.2.9, Tomcat 6.0.26, and mod_jk. I'm forwarding all
> > requests from Apache to Tomcat.
> 
> Then why are you bothering with httpd?  Remove it and simplify your life (and improve performance).

I have other pages requiring httpd.

> > <Context path="" docBase="jon3d-website-0.0.1.0-SNAPSHOT.war"
> 
> Putting <Context> elements in server.xml is a really, really bad idea.  The above is guaranteed to give you double deployment.  Best to just remove the <Context> element, and rename your .war file to ROOT.war.

What if I want to deploy other sites to the server?

> > Now, I want to be able to attach (static) content from a WAR, or even
> > better, a ZIP file, to a subdirectory, like http://jon3d.org/WebStart.
> 
> Then put the static content in webapps/WebStart.war; no <Context> element is needed.  You cannot use the .zip name, but you can just change the extension of the .zip file to .war (they're the same format).

That works, thanks!

>  - Chuck
> 
> 
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
-- 
Jon Kristensen <in...@jonkristensen.com>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Adding or Mount a Sub-Context or Archive to a Path

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Jon Kristensen [mailto:info@jonkristensen.com]
> Subject: Adding or Mount a Sub-Context or Archive to a Path
> 
> I'm using Apache 2.2.9, Tomcat 6.0.26, and mod_jk. I'm forwarding all
> requests from Apache to Tomcat.

Then why are you bothering with httpd?  Remove it and simplify your life (and improve performance).

> <Context path="" docBase="jon3d-website-0.0.1.0-SNAPSHOT.war"

Putting <Context> elements in server.xml is a really, really bad idea.  The above is guaranteed to give you double deployment.  Best to just remove the <Context> element, and rename your .war file to ROOT.war.

> Now, I want to be able to attach (static) content from a WAR, or even
> better, a ZIP file, to a subdirectory, like http://jon3d.org/WebStart.

Then put the static content in webapps/WebStart.war; no <Context> element is needed.  You cannot use the .zip name, but you can just change the extension of the .zip file to .war (they're the same format).

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.