1 Reply Latest reply on Apr 30, 2003 7:38 AM by Greg Wilkins

    Problem with request.getRequestURL()

    ddecker Newbie

      Hi,

      i have some trouble with a web-application using JBoss, Struts and TagLibs.
      In a TagLib-Tag i want to make a refresh of the request using the request.getRequestURL() - Method. The original request is something like http:/bla/bla.do which is a Mapping to an ActionClass. When i use Tomcat as Servlet-Container everything is fine and the getRequest - Method returns the wanted request-string.
      Now the Problem:
      When i change to Jetty/JBossWeb, the Method returns the JSP-Page to which the ActionClass has forwarded the request (http://bla/bla.jsp).
      Is it possible to read out the original request-string from a TagLib-Tag with JBossWeb/Jetty ?
      And how it is done ?

      Greetings Daniel

        • 1. Re: Problem with request.getRequestURL()
          Greg Wilkins Newbie


          I'm not that familiar with struts, but is sounds like a requestDispatcher is being used to forward the request from
          http:/bla/bla.do to http://bla/bla.jsp.

          If a RequestDispatcher.forward is being used, then Jetty is implementing the correct behaviour - and you can't find out the original request URL (I have suggested a change for the 2.4 servlet spec, which I think has been accepted that will change this).

          The question is - how is tomcat working? Which version of
          tomcat are you using???

          Can you verify if struts is doing a RequestDispatcher.forward?

          Note if it is, then there is a way in Jetty that you can get the original request. The request that you receive is just a standard request wrapper around the original request (and any other wrappers that filters may have added). So you can unwrap the request to find the original request and then call getRequestURI on it. Not very portable - but should not do any harm on other
          containers if you write it correctly.

          Alternately, write a filter that does a getRequestURL and stuffs it
          in a request attribute. Portable and can be removed once the 2.4 spec is available.