Please browse the categories below to previous answers to questions like yours. If you do not find the answer for your particular situation, ask for help on the appropriate mailing list.
(Answer) (Category) Java Apache Project : (Category) Apache JServ 1.0 : (Category) Programming and Misc. Tidbits :
Path translation issues...
----------
From: "Craig R. McClanahan" cmcclanahan@mytownnet.com
To: Java Apache Users java-apache-users@list.working-dogs.com
Subject: Re: Path translation bugs?
Date: Wed, Jun 9, 1999, 8:45 AM


Colin Low wrote:

> I tried the following in a JServ 1.b5 servlet running under Apache 1.3.6
>
> HttpRequest req.getRealPath(req.getRequestURI())
>
> returns the request URI appended to the document root, and no alias
> translation takes place, so the resulting path is useless.
>
> getServletConfig().getServletContext().getRealPath(req.getRequestURI())
>
> returns null, which isn't a lot of use either.
>
> Would anyone like to provide a rationale? I've read the Sun Servlet spec,
> and can't say that either result fits my expectation.
>
> Colin Low
>
> PS. Running on Windows
>

The technical reason for this is that the protocol currently used to connect
Apache and Apache JServ has no mechanism to ask Apache what the aliased path
should be.  The best we can do is take the Apache DOCUMENT_ROOT (which is
sent to JServ as part of the request) and tack on the path you specified.

Aliasing is applied in the restricted case where you call
request.getPathTranslated(), because Apache includes that translation when
it passes on the request -- but it fails in the general getRealPath() case.

IMHO:  This issue is not likely to be dealt with in 1.0, because of the
substantial amount of work involved.in rewriting the protocol.  Work is in
progress on a future version of the protocol, which should deal with it.

Craig McClanahan
[Append to This Answer]
Previous: (Answer) When I call HttpUtils.parsePostData() all the POST data is eaten by Apache Jserv. Is this a bug?
Next: (Answer) Ideas for dealing with long running computations in servlets...
This document is: http://java.apache.org/faq/?file=206
[Search] [Appearance] [Show Expert Edit Commands]
This is a Faq-O-Matic 2.709.
Please browse the categories below to previous answers to questions like yours. If you do not find the answer for your particular situation, ask for help on the appropriate mailing list.