struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "COMBEAU (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (WW-4750) Why JSONValidationInterceptor return Status Code 400 BAD_REQUEST instead of 200 SUCCESS
Date Mon, 06 Mar 2017 12:37:32 GMT

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

COMBEAU commented on WW-4750:
-----------------------------

Is my issue related to my jQuery version ? I don't think that's a jQuery issue. 

Why status code should be 400 when validation on server side is not correct. 

Explanation :
A request posted to the struts action can be good with no errors but a business rules on the
server side can throw "errors" if business rules are not "valid" and return some functionnal
errors to the client side and the status code shoud be 200.

Status code 400 means : The server cannot or will not process the request due to an apparent
client error (e.g., malformed request syntax, too large size, invalid request message framing,
or deceptive request routing).

You can see it on : [this site with the RFC2616|https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4]

> Why JSONValidationInterceptor return Status Code 400 BAD_REQUEST instead of 200 SUCCESS
> ---------------------------------------------------------------------------------------
>
>                 Key: WW-4750
>                 URL: https://issues.apache.org/jira/browse/WW-4750
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - JSON
>    Affects Versions: 2.5.10
>         Environment: Jdk 1.7, Windows 10, jQuery 1.7.2
>            Reporter: COMBEAU
>            Priority: Minor
>              Labels: docuentation, json, validation
>             Fix For: 2.5.next
>
>         Attachments: Issue in jQuery 1.7.2.png
>
>
> Since I have made the upgrade of my Struts 2.5.8 to 2.5.10, all my POST Ajax call via
jQuery with the parameter "struts.enableJSONValidation=true" return status code 400 Bad Request
when my validation on server side is wrong. 
> And I have an issue in the caller jQuery.
> {quote}
> Failed to load resource: the server responded with a status of 400 (Bad Request)
> {quote}
> Before in 2.5.8 and all previous versions the status code was 200.
> What is the reason of this changes because jQuery doesn't understand this and it's problematic.
I see this [WW-4728|https://issues.apache.org/jira/browse/WW-4728] but in this bug it was
not mention that the status code has to be changed.
> Please provide example in the documentation if the reason of the change is a specific
reason 
> Thank you in advance for your help.
> Best regards,



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message