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

Sarat Pediredla commented on WW-2358:
-------------------------------------

The correct RESTful error for validation seems to be 422 but even this is not 
supported by browsers. I have tested response code 422 on Firefox and Safari in 
Mac and the general behaviour is for the browser to die and present a blank 
screen instead of rendering the HTML.

I am not sure a HTTP Status code is required in this instance as the action and 
field errors map which is sent back will automatically give an indication of 
validation issues on the screen. I have therefore submitted a patch to fix this 
issue in browsers.



> RestWorkflowInterceptor in struts2-rest-plugin is returning a status which 
> kills browser sessions
> -------------------------------------------------------------------------------------------------
>
>                 Key: WW-2358
>                 URL: https://issues.apache.org/struts/browse/WW-2358
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Other
>    Affects Versions: 2.1.1
>         Environment: Struts 2.1.1-SNAPSHOT on Jetty 6.1.6
>            Reporter: Sarat Pediredla
>             Fix For: Future
>
>
> The RestWorkflowInterceptor in the struts2-rest-plugin is a cool addition but 
> unfortunately returns SC_BAD_REQUEST on validation fail, which might work 
> with testing frameworks but kills real browsers.
> The response tested on Safari 3 and Firefox 2.0.0.11 just shows a blank 
> screen. 
> If I change the following line from,
> HttpHeaders info = new DefaultHttpHeaders()
>                   .disableCaching()
>                   .renderResult(method)
>                   .withStatus(SC_BAD_REQUEST);
>               
> to,
> HttpHeaders info = new DefaultHttpHeaders()
>                   .disableCaching()
>                   .renderResult(method);
> then it works great as the server returns the right result as of validation 
> failure (editNew in this case)
> I am not entirely sure what the solution to this would be; either using a 
> status code that the browsers will respond to or maybe not have a status code 
> at all (although this might not be strictly RESTful) given that errors are 
> sent back in a Map.

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

Reply via email to