1 Reply Latest reply on May 30, 2006 7:54 AM by mailinator

    Request loses URL Parameter after doing a forward.

    mailinator Novice

      Within my Filters doFilter() i retrieve the RequestDispatcher and do a forward:

      RequestDispatcher rq = request.getRequestDispatcher("/pages/productDetail.jsf?id=hwcatalog/HW2200-0623&")
      requestDispatcher.forward(request, response);


      As we use JSF, i retrieve a URL-Parameter as following:
      ((ServletRequest)facesContext.getExternalContext.getRequest()).getParameter("id")


      From this point of view we have a different behaviour between OC4j and JBoss.
      OC4J returns "hwcatalog/HW2200-0623" (as expected)
      JBoss returns null.

      Can anybody confirm this JBoss behaviour?
      (JBoss 4.0.4 with JDK 1.5)

        • 1. Re: Request loses URL Parameter after doing a forward.
          mailinator Novice

          I must add something:

          We use the UrlRewriteFilter from http://tuckey.org/urlrewrite/.
          This Filter wraps within the doFilter() the current request and response into an UrlRewriteWrappedResponse.
          This wrapper overrides the encodeURL() method and is passed as parameter to the requestdispatcher instance.

          RequestDispatcher rq = request.getRequestDispatcher("/pages/productDetail.jsf?id=hwcatalog/HW2200-0623&")
          requestDispatcher.forward(request, wrappedResponse);


          At my first post i wrote, that after forwarding the available request doesn't know the URL parameter:
          After further debugging i noticed that this isn't the case.

          ((ServletRequest)facesContext.getExternalContext.getRequest()).getParameter("id")

          retrieves the correct value for paramater 'id'.

          The different behaviour between OC4J and Jboss lays in the wrapped request within the UrlRewriteWrappedResponse.
          OC4J's wrapped request knows the updated URL Parameter but
          JBoss' wrapped request doesn't have noticed the change.

          Can it be that JBoss creates a new Request instance after a forward
          whereas OC4J updates the existing one?
          And what is the correct behaviour?
          I can't find any information about this issue.

          Thanks
          Denny