You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Sarat Pediredla (JIRA)" <ji...@apache.org> on 2007/12/06 10:55:34 UTC

[jira] Created: (WW-2358) RestWorkflowInterceptor in struts2-rest-plugin is returning a status which kills browser sessions

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


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.


[jira] Commented: (WW-2358) RestWorkflowInterceptor in struts2-rest-plugin is returning a status which kills browser sessions

Posted by "Sarat Pediredla (JIRA)" <ji...@apache.org>.
    [ 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.


[jira] Updated: (WW-2358) RestWorkflowInterceptor in struts2-rest-plugin is returning a status which kills browser sessions

Posted by "James Holmes (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2358?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

James Holmes updated WW-2358:
-----------------------------

    Flags: [Patch]

> 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: 2.1.3
>
>         Attachments: WW-2358.patch
>
>
> 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.


[jira] Updated: (WW-2358) RestWorkflowInterceptor in struts2-rest-plugin is returning a status which kills browser sessions

Posted by "James Holmes (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2358?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

James Holmes updated WW-2358:
-----------------------------

    Fix Version/s:     (was: Future)
                   2.1.3

In my opinion this needs to be resolved as part of the 2.1.x release cycle as that's where we're introducing the REST plugin.

> 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: 2.1.3
>
>         Attachments: WW-2358.patch
>
>
> 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.


[jira] Updated: (WW-2358) RestWorkflowInterceptor in struts2-rest-plugin is returning a status which kills browser sessions

Posted by "Sarat Pediredla (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2358?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sarat Pediredla updated WW-2358:
--------------------------------

    Attachment: WW-2358.patch

Fixes the issue with browsers dying on SC_BAD_REQUEST HTTP response code. I have tested this in all major browsers and validation errors are thrown properly without the browser dying.

> 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
>
>         Attachments: WW-2358.patch
>
>
> 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.


[jira] Commented: (WW-2358) RestWorkflowInterceptor in struts2-rest-plugin is returning a status which kills browser sessions

Posted by "Wes Wannemacher (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2358?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=43390#action_43390 ] 

Wes Wannemacher commented on WW-2358:
-------------------------------------

Sadat, if you are still watching this issue (or anyone), a little searching found that Roy F (the main dude behind REST) suggested status code 422 be used on validation failures ->
http://tech.groups.yahoo.com/group/rest-discuss/message/6183
It appears this comes from the WebDAV spec. Could someone familiar with RoR check what they do when validation fails? Incidentally, it appears that HttpServletResponse doesn't have a const to represent "unprocessable entity," so this would have to be inserted explicitly.

> 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.


[jira] Updated: (WW-2358) RestWorkflowInterceptor in struts2-rest-plugin is returning a status which kills browser sessions

Posted by "Don Brown (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2358?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Don Brown updated WW-2358:
--------------------------

    Component/s:     (was: Other)
                 Plugin - REST

> 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: Plugin - REST
>    Affects Versions: 2.1.1
>         Environment: Struts 2.1.1-SNAPSHOT on Jetty 6.1.6
>            Reporter: Sarat Pediredla
>             Fix For: 2.1.3
>
>         Attachments: WW-2358.patch
>
>
> 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.


[jira] Resolved: (WW-2358) RestWorkflowInterceptor in struts2-rest-plugin is returning a status which kills browser sessions

Posted by "Don Brown (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2358?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Don Brown resolved WW-2358.
---------------------------

    Resolution: Fixed
      Assignee: Don Brown

This is now customizable via the struts.rest.validationFailureStatusCode  setting

> 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: Plugin - REST
>    Affects Versions: 2.1.1
>         Environment: Struts 2.1.1-SNAPSHOT on Jetty 6.1.6
>            Reporter: Sarat Pediredla
>            Assignee: Don Brown
>             Fix For: 2.1.3
>
>         Attachments: WW-2358.patch
>
>
> 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.