struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Musachy Barroso (JIRA)" <j...@apache.org>
Subject [jira] Commented: (WW-3192) When struts is used to render an error-page, getting the action mapping from original request
Date Tue, 11 Aug 2009 19:11:59 GMT

    [ https://issues.apache.org/struts/browse/WW-3192?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46590#action_46590
] 

Musachy Barroso commented on WW-3192:
-------------------------------------

I was unable to reproduce this, this is what I tried, I modified the blank application so
I have this 2 actions:

        <action name="HelloWorld" class="example.HelloWorld">
            <result type="httpheader">
                <param name="error">404</param>
            </result>
        </action>

        <action name="Login_*" method="{1}" class="example.Login">
            <result name="input">/example/Login.jsp</result>
            <result type="redirectAction">Menu</result>
        </action>

in web.xml, I have:

 <filter>
        <filter-name>struts2</filter-name>
        <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
    </filter>

    <filter-mapping>
        <filter-name>struts2</filter-name>
        <url-pattern>/*</url-pattern>
        <dispatcher>ERROR</dispatcher>
        <dispatcher>REQUEST</dispatcher>
    </filter-mapping>

    <welcome-file-list>
        <welcome-file>index.html</welcome-file>
    </welcome-file-list>

    <error-page>
        <error-code>404</error-code>
        <location>/example/Login_input.action</location>
    </error-page>

When I go to: http://localhost:8080/struts2-blank/example/HelloWorld.action , I see the Login
page. Do you have "  <dispatcher>ERROR</dispatcher>" in the mapping for the filter?
Otherwise Struts will not see the request to your error page made by the container.

> When struts is used to render an error-page, getting the action mapping from original
request
> ---------------------------------------------------------------------------------------------
>
>                 Key: WW-3192
>                 URL: https://issues.apache.org/struts/browse/WW-3192
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Dispatch Filter
>    Affects Versions: 2.1.6
>         Environment: Tomcat 
>            Reporter: Jasper Rosenberg
>            Priority: Critical
>             Fix For: 2.1.8
>
>
> We have mapped 404 in the web.xml to a struts action, e.g.:
>   <error-page>
>     <error-code>404</error-code>
>     <location>/404.action</location>
>   </error-page> 
> Sometimes we have an action return a result type to generate a 404 error. This used to
work.  However, now it is failing because PrepareOperations.findActionMapping() is finding
the original mapping still in the request when the servlet container invokes the 404.action
(and so not getting the struts mapping for the 404 action).   I assume this is also a bug
for actions that return a 500 error where the 500 error page is rendered in struts though
I haven't tested it yet.
> One fix would be to call request.removeAttribute(STRUTS_ACTION_MAPPING_KEY) at the end
of  PrepareOperations.cleanupRequest() though perhaps there are implications to that I'm unaware
of.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message