You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Karthik Nanjangude <ka...@xius-bcgi.com> on 2008/10/08 15:25:33 UTC

external folder be mapped to Tomcat 'specific 'web application'

Hi


SPEC
TOMCAT 6018
O/s UNIX11
J2SDK 1.6


Folder  :   /root/images
Web application folder   :   /root/TOMCAT6018 / webapps / XYZAPPS


Note: by defining the  xml in context under   TOMCAT6018/conf/Catalina\localhost
         Virtual Mapping  as  'http://<IP>:<PORT>/images'  can be achieved


Question

Can a external folder be mapped to Tomcat 'specific 'web application'   only  as shown below

The URL Mapping should be    http://<IP>:<PORT>/XYZAPPS/images

Reason : Most of the APP Servers  for web container  provide this functionality




With regards
Karthik

Re: external folder be mapped to Tomcat 'specific 'webapplication'

Posted by albrecht andrzejewski <al...@ema.fr>.
> Folder  :   /root/images
> Web application folder   :   /root/TOMCAT6018 / webapps / XYZAPPS

> Question
>
> Can a external folder be mapped to Tomcat 'specific 'web   
> application'   only  as shown below

If a folder is external, why should it be considered as part of the  
webapp context ?
A popular reason why tomcat administrators used Apache httpd as a  
frontend to tomcat was (i said was, because it seems to be another cup  
of tea with today's server performance) to allow serving static  
content like images, without having a slower process using java for a  
simple GET over static files.

Accesing your /root/images with your webapp URL over the internet can be made:
- using url rewriting techniques (mod_rewrite or tomcat filter)
- by including this folder to your web app (!) so it becomes an  
internal webapp folder
- by setting up an apache frontend which declare a virtual host  
redirecting all 'http://<IP>:<PORT>/images/' to the document root  
"/root/images" and passing all other request to mod_proxy or mod_jk.
- perhaps by putting a symbolic link (ln -s) to your image folder  
within your webapp directory ?

Regards, i hope this answer brings you help.
Ps: i wouldn't use my root account to store my webapp or web  
content...neither to run an application server.


-- 
Albrecht ANDRZEJEWSKI
Créateur - Incubateur Technologique
SITE-EERIE - Parc scientifique G. Besse
***
http://haveacafe.wordpress.com

----------------------------------------------------
Ce message a ete envoye par le serveur IMP de l'EMA.



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


RE: external folder be mapped to Tomcat 'specific 'web application'

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Karthik Nanjangude [mailto:karthik.nanjangude@xius-bcgi.com]
> Subject: RE: external folder be mapped to Tomcat 'specific
> 'web application'
>
> Question: Can this configuration be done from within
> 'XYZAPPS/META-INF/context.xml'
> Specific to the application only

No - webapps are independent (required by the servlet spec); you cannot declare one inside another.

 - 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.

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


RE: external folder be mapped to Tomcat 'specific 'web application'

Posted by Karthik Nanjangude <ka...@xius-bcgi.com>.
Hi

Absolutely perfect, this works,thx

>> Yes, just set up a sub-context. Something like a file called:
  $CATALINA_BASE/Catalina/localhost/XYZAPPS#images.xml
  with content:
  <Context docBase="/root/images" />


Question: Can this configuration be done from within
'XYZAPPS/META-INF/context.xml'
Specific to the application only




with regards
Karthik



-----Original Message-----
From: Caldarale, Charles R [mailto:Chuck.Caldarale@unisys.com]
Sent: Friday, October 10, 2008 8:35 PM
To: Tomcat Users List
Subject: RE: external folder be mapped to Tomcat 'specific 'web application'

> From: Karthik Nanjangude [mailto:karthik.nanjangude@xius-bcgi.com]
> Subject: RE: external folder be mapped to Tomcat 'specific
> 'web application'
>
> 1) My external folder which has *images* is on folder "e/STATICIMAGES"

I presume there's a colon missing in the above, and all your forward slashes should really be back slashes.  (It helps to be precise, so people don't have to guess at what you're really doing.)

> 2) TOMCAT6018 is installed on folder "D:/TOMCAT5523"
>
> Is this possible to map the "STATICIMAGES"  to webapps  to
> serve in browser as
>
> * http://<IP>:<PORT>/XYZAPPS/STATICIMAGES *

Mark T already told you exactly how to do this:

  Yes, just set up a sub-context. Something like a file called:
  $CATALINA_BASE/Catalina/localhost/XYZAPPS#images.xml
  with content:
  <Context docBase="/root/images" />

For your specific environment, the file containing the <Context> element is:
  D:\TOMCAT5523\Catalina\localhost\XYZAPPS#STATICIMAGES.xml
(assuming you insist on using upper case names; this is case-sensitive, even on Windows).

The <Context> element within the above file looks like this:
  <Context docBase="E:/STATICIMAGES" />
(Yes, that is a forward slash in the above, even on Windows.)

 - 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.


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



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


RE: external folder be mapped to Tomcat 'specific 'web application'

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Karthik Nanjangude [mailto:karthik.nanjangude@xius-bcgi.com]
> Subject: RE: external folder be mapped to Tomcat 'specific
> 'web application'
>
> 1) My external folder which has *images* is on folder "e/STATICIMAGES"

I presume there's a colon missing in the above, and all your forward slashes should really be back slashes.  (It helps to be precise, so people don't have to guess at what you're really doing.)

> 2) TOMCAT6018 is installed on folder "D:/TOMCAT5523"
>
> Is this possible to map the "STATICIMAGES"  to webapps  to
> serve in browser as
>
> * http://<IP>:<PORT>/XYZAPPS/STATICIMAGES *

Mark T already told you exactly how to do this:

  Yes, just set up a sub-context. Something like a file called:
  $CATALINA_BASE/Catalina/localhost/XYZAPPS#images.xml
  with content:
  <Context docBase="/root/images" />

For your specific environment, the file containing the <Context> element is:
  D:\TOMCAT5523\Catalina\localhost\XYZAPPS#STATICIMAGES.xml
(assuming you insist on using upper case names; this is case-sensitive, even on Windows).

The <Context> element within the above file looks like this:
  <Context docBase="E:/STATICIMAGES" />
(Yes, that is a forward slash in the above, even on Windows.)

 - 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.


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


RE: external folder be mapped to Tomcat 'specific 'web application'

Posted by Karthik Nanjangude <ka...@xius-bcgi.com>.
Hi

I have checkd the URL ' http://tomcat.apache.org/tomcat-6.0-doc/config/context.html

done the same for our applications, But please check if this can be achieved
?



1) My external folder which has *images* is on folder "e/STATICIMAGES"

2) TOMCAT6018 is installed on folder "D:/TOMCAT5523"

3) The web apps under "XYZAPPS" is as  "D:/TOMCAT5523/webapps/XYZAPPS"
   and accessible via "http://<IP>:<PORT>/XYZAPPS"


Is this possible to map the "STATICIMAGES"  to webapps  to serve in browser as

* http://<IP>:<PORT>/XYZAPPS/STATICIMAGES *


With regardfs
Karthik



-----Original Message-----
From: Mark Thomas [mailto:markt@apache.org]
Sent: Wednesday, October 08, 2008 7:32 PM
To: Tomcat Users List
Subject: Re: external folder be mapped to Tomcat 'specific 'web application'

Karthik Nanjangude wrote:
> Hi
>
>
> SPEC
> TOMCAT 6018
> O/s UNIX11
> J2SDK 1.6
>
>
> Folder  :   /root/images
> Web application folder   :   /root/TOMCAT6018 / webapps / XYZAPPS
>
>
> Note: by defining the  xml in context under   TOMCAT6018/conf/Catalina\localhost
>          Virtual Mapping  as  'http://<IP>:<PORT>/images'  can be achieved
>
>
> Question
>
> Can a external folder be mapped to Tomcat 'specific 'web application'   only  as shown below
>
> The URL Mapping should be    http://<IP>:<PORT>/XYZAPPS/images

Yes, just set up a sub-context. Something like a file called:
$CATALINA_BASE/Catalina/localhost/XYZAPPS#images.xml

with content:
<Context docBase="/root/images" />

> Reason : Most of the APP Servers  for web container  provide this functionality

So does Tomcat ;)

See http://tomcat.apache.org/tomcat-6.0-doc/config/context.html for details.

Mark


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



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


Re: external folder be mapped to Tomcat 'specific 'web application'

Posted by Mark Thomas <ma...@apache.org>.
Karthik Nanjangude wrote:
> Hi
> 
> 
> SPEC
> TOMCAT 6018
> O/s UNIX11
> J2SDK 1.6
> 
> 
> Folder  :   /root/images
> Web application folder   :   /root/TOMCAT6018 / webapps / XYZAPPS
> 
> 
> Note: by defining the  xml in context under   TOMCAT6018/conf/Catalina\localhost
>          Virtual Mapping  as  'http://<IP>:<PORT>/images'  can be achieved
> 
> 
> Question
> 
> Can a external folder be mapped to Tomcat 'specific 'web application'   only  as shown below
> 
> The URL Mapping should be    http://<IP>:<PORT>/XYZAPPS/images

Yes, just set up a sub-context. Something like a file called:
$CATALINA_BASE/Catalina/localhost/XYZAPPS#images.xml

with content:
<Context docBase="/root/images" />

> Reason : Most of the APP Servers  for web container  provide this functionality

So does Tomcat ;)

See http://tomcat.apache.org/tomcat-6.0-doc/config/context.html for details.

Mark


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