users@glassfish.java.net

Re: Problem with Glassfish v2 b33 and Spring webflow ( worked with Glassfish v2 b19 )

From: Jan Luehe <Jan.Luehe_at_Sun.COM>
Date: Mon, 23 Apr 2007 19:25:09 -0700

Heimo,

Heimo Laukkanen wrote On 04/23/07 10:59 AM,:

> Hi,
>
> I'm developing an application on Glassfish with Spring Webflow - and
> noticed that some changes in Glassfish v2 between b19 and b33 affects
> how Webflow works.
>
> In webflow a central controller works as a front controller and uses
> jsp views to produce the output to the user.
>
> Normally ( in Tomcat 5.5.23 or in Glassfish v2 b19 ) each JSP view
> produces output about request URL that points back to the controller,
> but in b33 requestURL from the request produces URL that points
> straight to the view that is not accessible.
>
> In example:
>
> ${pageContext.request.requestURL} -->
> http://localhost:8080/uep/WEB-INF/views/experienceForm.jsp
>
> ${pageContext.request.contextPath } --> /uep , which is what is
> expected. Context root for the webapplication
>
> ${pageContext.request.pathTransla
> ted} -->
> /Users/huima/glassfish/glassfish-b33e/domains/domain1/applications/j2ee-modules/form/start.htm
> This is the path to the flow controller on the server.
>
> ${pageContext.request.requestURI } -->
> /uep/WEB-INF/views/experienceForm.jsp
> This is path to the view in the war.
>
> Thread about the issue on Spring forums:
> http://forum.springframework.org/showthread.php?p=115654#post115654
>
> Any information on whether to file a bugreport and how to look
> further, and possibly debug on where the problem might be, is appreciated.


Hmm, I assume your controller invokes the view via
RequestDispatcher.forward()?

In this case, the path elements of the request object exposed to the
view must reflect the path used to obtain the RequestDispatcher, as
per the servlet spec

Therefore, if your view is invoked like this:

  
getServletContext().getRequestDispatcher("/WEB-INF/views/experienceForm.jsp").forward(req,
res);

from the controller within the /uep context,

  ${pageContext.request.requestURI}

must evaluate to

  /uep/WEB-INF/views/experienceForm.jsp

in the view.

The original request URI that was used to invoke the controller is
available to the view as a request attribute with name
"javax.servlet.forward.request_uri", so from your view, you could access
it as follows:

  ${requestScope["javax.servlet.forward.request_uri"]}

Hope this helps.


Jan