You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Sjoerd van Leent <sv...@wanadoo.nl> on 2004/02/27 19:00:26 UTC

Context to path

Every web-app is in a context. Every context is in a path on the system. The
question is, how can I translate a context to a system path.

 

For example a context is in the following path:

 

E:\xxx\yyy\myContext

 

The web-app is in:

 

http://localhost:8080/myContext

 

How can I translate that using a PageContext or something similar into the
path mentioned above. Any suggestions?

 

Thanks in advance,

Sjoerd van Leent

 

 


RE: Context to path

Posted by Sjoerd van Leent <sv...@wanadoo.nl>.
Actually, I already did this before but lost the solution. I remember that I
also used JNDI (or should I say, abuse JNDI) to get the actual context path.

Making a standard taglib and factory method for this seems to be not to much
of an effort.

Thanks again for this quick response.

-----Oorspronkelijk bericht-----
Van: Asim Alp [mailto:dev.list@educationalnetworks.net] 
Verzonden: vrijdag 27 februari 2004 19:04
Aan: Tomcat Users List
Onderwerp: Re: Context to path

What I usually do is this:

pageContext.getServletContext().getContext("/myContext").getRealPath("/ 
myfile.jsp")));

Asim Alp
Educational Networks
55 Broad Street, 10th Floor
New York, NY 10004
www.educationalnetworks.net

Tel: +1 (212) 269-0200
Fax: +1 (212) 269-1446
On Feb 27, 2004, at 1:00 PM, Sjoerd van Leent wrote:

> Every web-app is in a context. Every context is in a path on the  
> system. The
> question is, how can I translate a context to a system path.
>
>
>
> For example a context is in the following path:
>
>
>
> E:\xxx\yyy\myContext
>
>
>
> The web-app is in:
>
>
>
> http://localhost:8080/myContext
>
>
>
> How can I translate that using a PageContext or something similar into  
> the
> path mentioned above. Any suggestions?
>
>
>
> Thanks in advance,
>
> Sjoerd van Leent
>
>
>
>
>



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


Re: Context to path

Posted by Asim Alp <de...@educationalnetworks.net>.
What I usually do is this:

pageContext.getServletContext().getContext("/myContext").getRealPath("/ 
myfile.jsp")));

Asim Alp
Educational Networks
55 Broad Street, 10th Floor
New York, NY 10004
www.educationalnetworks.net

Tel: +1 (212) 269-0200
Fax: +1 (212) 269-1446
On Feb 27, 2004, at 1:00 PM, Sjoerd van Leent wrote:

> Every web-app is in a context. Every context is in a path on the  
> system. The
> question is, how can I translate a context to a system path.
>
>
>
> For example a context is in the following path:
>
>
>
> E:\xxx\yyy\myContext
>
>
>
> The web-app is in:
>
>
>
> http://localhost:8080/myContext
>
>
>
> How can I translate that using a PageContext or something similar into  
> the
> path mentioned above. Any suggestions?
>
>
>
> Thanks in advance,
>
> Sjoerd van Leent
>
>
>
>
>