You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "jagub zhang (JIRA)" <ji...@apache.org> on 2011/06/20 11:44:47 UTC

[jira] [Commented] (WW-3389) StatusCode parameter in the URL

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

jagub zhang commented on WW-3389:
---------------------------------

it was worked correctly on version 2.0.6, because 2.0.6 did't support extend parameter registered in result definition.
it means you can not change the default statusCode(302).

at version 2.1.x, you can set the statusCode youself,
but I also think the statusCode had showed in URL is a bug.

if you modify the file : org.apache.struts2.dispatcher.ServletRedirectResult
at line 200~204, add statusCode to prohibited list
form:
    protected List<String> getProhibitedResultParams() {
        return Arrays.asList(new String[]{
                DEFAULT_PARAM, "namespace", "method", "encode", "parse", "location",
                "prependServletContext", "supressEmptyParameters"});
    }

to:

    protected List<String> getProhibitedResultParams() {
        return Arrays.asList(new String[]{
                DEFAULT_PARAM, "namespace", "method", "encode", "parse", "location",
                "prependServletContext", "supressEmptyParameters", "statusCode"});
    }

you can fix this bug.


> StatusCode parameter in the URL
> -------------------------------
>
>                 Key: WW-3389
>                 URL: https://issues.apache.org/jira/browse/WW-3389
>             Project: Struts 2
>          Issue Type: Bug
>    Affects Versions: 2.1.8.1
>            Reporter: Gabriel
>            Priority: Minor
>             Fix For: 2.2.x
>
>
> I have a redirect result configuration where I change the statusCode:
> <result name="permanentRedirect" type="redirect">
>   <param name="location">${redirectUrl}</param>
>   <param name="statusCode">301</param>
>   <param name="prependServletContext">false</param>
> </result>
> When the redirect occurs, it appends a statusCode parameter on the URL, like this:  http://domain.com/path?statusCode=301
> It was working correctly on version 2.0.6, with no statusCode in the URL

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira