From: <php...@li...> - 2010-08-11 20:44:52
|
On Wed, Aug 11, 2010 at 6:05 PM, < php...@li...> wrote: > > if I remember correctly we don't need to > > if I remember correctly we don't need to > > check "javax.include.request_uri" attribute, because it is guaranteed > > to be the same as the return value of getRequestUri() > > Above statement is false. javax.servlet.include points to the target > and javax.servlet.forward to the source. We are interested in the > target but not in the source; the current Java Bridge code is correct. > For my scenario, taking the target but not the source caused problem. I'll explain as follows: > > <!-- from.jsp --> > <jsp:include page="to.php"/> > > getXXXX() methods => from > javax.servlet.include.xxx => to > > let me put the include case aside and look at the forward case only. > > <!-- from.jsp --> > <jsp:forward page="to.php"/> > > getXXXX() methods => to.php > javax.servlet.forward.xxx => from > Your example exactly match my understanding. If there are multiple from.jsp, e.g. from.jsp -> from2.jsp -> to.php, the javax.servlet.forward will include the first "from.jsp". The actual case is, user makes a request to "/", and jetty explicitly (not transparently) forward the request to "/index.php", and PJB uses the request at the time of "/index.php". When the page is forwarded to /index.php, the getRequestURI() correctly shows it is "/index.php". Jetty behaves correctly. For this scenario, JavaBridge should not use the to.php as REQUEST_URI, but should use the from. There is no problem in Tomcat because when we make a request to "/", it transparently take the index file "/index.php" but getRequestURI() remains at "/". But Jetty implements it differently and make the forwarding explicit. > If jetty returns null for request.getRequestURI(), please report this > bug to the jetty maintainer. We cannot work around this jetty bug. > as mentioned above, jetty correctly provides the requestURI value. it doesn't return null. I have to clarify it is not a Jetty bug and from understanding, Jetty behaves correctly. Now, come back to the question of whether Java Bridge should take the source or the target? it seems to me Java Bridge should always take the source as it is server side forwarding but not http redirect. When I try to get the REQUEST_URI in php, i expect to get the original request uri that the user make, which is the source but not the target. Is there any scenario Java Bridge will get problem if the source instead of target is taken? regards, mingfai |