Problems:

I'm trying to get the real file path to a "possibly" remapped jsp page

I.E. in web.xml -->

  <servlet>
    <servlet-name>JSPTestMap</servlet-name>
    <jsp-file>/Jaxp/JSPTransformExample.jsp</jsp-file>
  </servlet>
  <servlet-mapping>
    <servlet-name>JSPTestMap</servlet-name>
    <url-pattern>/Jaxp/MapExample.jsp</url-pattern>
  </servlet-mapping>

maps the request "/Jaxp/MapExample.jsp" to "/Jaxp/JSPTransformExample.jsp"

if I run your example on the following uri

http://localhost:8180/Jaxp/MapExample.jsp

I see

/var/tomcat4/webapps/Taglib/Taglib/Jaxp/MapExample.jsp

which is not what I'm looking for, I want to get back

/var/tomcat4/webapps/Taglib/Jaxp/JSPTransformExample.jsp

(This is because "application.getRealPath(...)" does nothing glorious 
but append the the string you feed it onto the real path to the Context. 
It may not neccessarily be a "Real" path.

-Mark

Ryan Lubke wrote:

>Let me try that again....
>
>I think you could use the requestURI() method of the
>HttpServletRequest object and pass that to
>ServletContext.getRealPath().
> 
>Example:
>
><% out.println(application.getRealPath(request.getRequestURI())); %>
>
>Output for the following request to the above code: 
>
>Request: http://localhost:8080/tomcat-docs/test.jsp
>
>Result:
>/files/projects/jakarta-tomcat-4.0/build/webapps/tomcat-docs/tomcat-docs/test.jsp
>
>You have to be careful when using this method. If the deployed application 
>is run out of the WAR file (it's not expanded on the filesystem), 
>then getRealPath will return null.
>
>  
>
>>On Mon, 2002-08-26 at 16:17, Mark R. Diggory wrote:
>>    
>>
>>>Hi,
>>>
>>>I'm trying to write a Tag that knows the absolute file path of the JSP 
>>>Page it is executing in (Not the request.getServletPath(), which could 
>>>actually just be a servlet mapping) does anyone have any tips on how to 
>>>get this in Tomcat? I was actually looking throught the actuall Catalina 
>>>code base and came across a class org.apache.catalina.Globals which 
>>>suggests that there are references to to things like (jsp-file, 
>>>servlet-path) from the web.xml present in the request sttributes. But I 
>>>fail to see them.
>>>
>>>-Mark
>>>
>>>
>>>
>>>--
>>>To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
>>>For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>>>
>>>      
>>>
>>
>>--
>>To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
>>For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>>
>>    
>>
>
>
>
>--
>To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>  
>




--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to