[ 
https://issues.apache.org/jira/browse/OFBIZ-5109?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jacques Le Roux updated OFBIZ-5109:
-----------------------------------

    Description: 
Currently when we define a request-redirect in controllers it underneath uses 
the Java default 302 redirections ([temporary 
redirect|http://en.wikipedia.org/wiki/List_of_HTTP_status_codes#3xx_Redirection]).
 
Actually all redirect response types (url, cross-redirect, request-redirect, 
request-redirect-noparam) call  HttpServletResponse.sendRedirect() through 
RequestHandler.callRedirect(). So all controllers redirections do temporary 
redirects (302). Ths is all good as long as you don't worry about SEO best 
practices which recommend to use 301 instead of 302 (Google for "301 vs 302" or 
see [1], [2], [3]).

This matters only for eCommerce. In the context of an ERP (or backend by and 
large), we want to replace 302 by 303 and keep the possibility to use 302 (for 
[Post/Redirect/Get pattern|http://en.wikipedia.org/wiki/Post/Redirect/Get] 
where 303 is best on HTTP 1.1, 302 on HTTP 1.0)


I want to set a default 303 status-code property in requestHandler.properties 
file. Which could be changed for 302 for those who prefer it. The idea is then 
to allow to override this default value with a status-code attribute on the 
response element. But since I want also to be able to override a complete 
controller (like for an eCommerce controller) without having to override each 
concerned requests. I finally decided to use also a status-code element in 
site-conf.xsd to be placed before handlers:

<xs:element name="status-code" type="xs:string"/>

If present, this will override the status-code property. And the status-code 
attribute on the response element will override both (cascading), eg:

<response name="success" type="request-redirect" value="main" 
status-code="301"/>


[1] http://support.google.com/webmasters/bin/answer.py?hl=en&answer=93633
[2] http://support.google.com/webmasters/bin/answer.py?hl=en&answer=40132
[3] http://searchengineland.com/images/301-302-explained.gif


  was:
Currently when we define a request-redirect in controllers it underneath uses 
the Java default 302 redirections ([temporary 
redirect|http://en.wikipedia.org/wiki/List_of_HTTP_status_codes#3xx_Redirection]).
 
Actually all redirect response types (url, cross-redirect, request-redirect, 
request-redirect-noparam) call  HttpServletResponse.sendRedirect() through 
RequestHandler.callRedirect(). So all controllers redirections do temporary 
redirects (302). Ths is all good as long as you don't worry about SEO best 
practices which recommend to use 301 instead of 302 (Google for "301 vs 302" or 
see [1], [2], [3]).

This matters only for eCommerce. In the context of an ERP (or backend by and 
large), we want to replace 302 by 303 and keep the possibility to use 302 (for 
[Post/Redirect/Get pattern|http://en.wikipedia.org/wiki/Post/Redirect/Get] 
where 303 is best on HTTP 1.1, 302 on HTTP 1.0)


I want to set a default 303 redirectionCode property in url.properties file. 
Which could be changed for 302 for those who prefer it. The idea is then to 
allow to override this default value in a code attribute on the response 
element. But since I want also to be able to override a complete controller 
(like for an eCommerce controller) without having to override each concerned 
requests. I finally decided to use also a redirection-code element in 
site-conf.xsd to be placed before handlers:

<xs:element name="redirection-code" type="xs:string"/>

If present, this will override the redirectionCode property. And the code 
attribute on the response element will override both (cascading), eg:

<response name="success" type="request-redirect" value="main" code="301"/>


[1] http://support.google.com/webmasters/bin/answer.py?hl=en&answer=93633
[2] http://support.google.com/webmasters/bin/answer.py?hl=en&answer=40132
[3] http://searchengineland.com/images/301-302-explained.gif



Amended to use rather status-code name for all and already existing 
requestHandler.properties created recently for 
throwRequestHandlerExceptionOnMissingLocalRequest specific case, see OFBIZ-5037
                
> Allow a whole controller or/and request/s to override a default 303 in case 
> of redirect
> ---------------------------------------------------------------------------------------
>
>                 Key: OFBIZ-5109
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-5109
>             Project: OFBiz
>          Issue Type: Improvement
>          Components: ALL COMPONENTS
>    Affects Versions: SVN trunk
>            Reporter: Jacques Le Roux
>            Assignee: Jacques Le Roux
>            Priority: Minor
>              Labels: 301, 302, 303, code, redirection, redirectionCode, seo
>             Fix For: SVN trunk
>
>
> Currently when we define a request-redirect in controllers it underneath uses 
> the Java default 302 redirections ([temporary 
> redirect|http://en.wikipedia.org/wiki/List_of_HTTP_status_codes#3xx_Redirection]).
>  
> Actually all redirect response types (url, cross-redirect, request-redirect, 
> request-redirect-noparam) call  HttpServletResponse.sendRedirect() through 
> RequestHandler.callRedirect(). So all controllers redirections do temporary 
> redirects (302). Ths is all good as long as you don't worry about SEO best 
> practices which recommend to use 301 instead of 302 (Google for "301 vs 302" 
> or see [1], [2], [3]).
> This matters only for eCommerce. In the context of an ERP (or backend by and 
> large), we want to replace 302 by 303 and keep the possibility to use 302 
> (for [Post/Redirect/Get 
> pattern|http://en.wikipedia.org/wiki/Post/Redirect/Get] where 303 is best on 
> HTTP 1.1, 302 on HTTP 1.0)
> I want to set a default 303 status-code property in requestHandler.properties 
> file. Which could be changed for 302 for those who prefer it. The idea is 
> then to allow to override this default value with a status-code attribute on 
> the response element. But since I want also to be able to override a complete 
> controller (like for an eCommerce controller) without having to override each 
> concerned requests. I finally decided to use also a status-code element in 
> site-conf.xsd to be placed before handlers:
> <xs:element name="status-code" type="xs:string"/>
> If present, this will override the status-code property. And the status-code 
> attribute on the response element will override both (cascading), eg:
> <response name="success" type="request-redirect" value="main" 
> status-code="301"/>
> [1] http://support.google.com/webmasters/bin/answer.py?hl=en&answer=93633
> [2] http://support.google.com/webmasters/bin/answer.py?hl=en&answer=40132
> [3] http://searchengineland.com/images/301-302-explained.gif

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to