[jboss-jira] [JBoss JIRA] (WFLY-4106) jsp-file directive prevents RequestDispatcher#forward to work correctly

Stuart Douglas (JIRA) issues at jboss.org
Thu Nov 20 19:13:39 EST 2014


     [ https://issues.jboss.org/browse/WFLY-4106?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stuart Douglas moved UNDERTOW-346 to WFLY-4106:
-----------------------------------------------

        Project: WildFly  (was: Undertow)
            Key: WFLY-4106  (was: UNDERTOW-346)
    Component/s: Web (Undertow)
                     (was: Servlet)


> jsp-file directive prevents RequestDispatcher#forward to work correctly
> -----------------------------------------------------------------------
>
>                 Key: WFLY-4106
>                 URL: https://issues.jboss.org/browse/WFLY-4106
>             Project: WildFly
>          Issue Type: Bug
>          Components: Web (Undertow)
>         Environment: WildFly 8.1.0.Final on OSX running on JDK7
>            Reporter: Peter Major
>            Assignee: Stuart Douglas
>         Attachments: example.war
>
>
> When there is a servlet specified like:
> {noformat}
> <servlet>
>         <servlet-name>index</servlet-name>
>         <jsp-file>/index.jsp</jsp-file>
>     </servlet>
>     <servlet-mapping>
>         <servlet-name>index</servlet-name>
>         <url-pattern>/index</url-pattern>
>     </servlet-mapping>
> {noformat}
> and the backing JSP uses RequestDispatcher#forward pointing to a different JSP file, the JspServlet will unfortunately try to render the first JSP again, resulting in StackOverflowError in most of the time.
> When investigating this issue with the debugger by making a sample request to /index, it appeared that JspFileHandler sets the request attribute Constants.JSP_FILE, and that will have the value of the JSP file from the <jsp-file> directive. This is great, until the JSP itself tries to call RequestDispatcher#forward using a path on the servletcontext, such as /hello.jsp. In this scenario, JspFileHandler no longer gets invoked, because simply that JSP isn't bound to a servlet, so the request attribute remain the old value and JspServlet just simply grabs the value from the request attribute again and displays the /index.jsp again, and again, and again.
> This looks to be a bug in Jastow, but I'm not really sure how to fix it. I would assume that using dispatcher#forward from a JSP to call an another JSP (even indirectly, i.e. through dispatching the request to a servlet, which then would dispatch the request to a JSP) should be within the bounds of the servlet spec, but let me know if I'm violating the spec with my application in any ways.



--
This message was sent by Atlassian JIRA
(v6.3.8#6338)


More information about the jboss-jira mailing list