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

Eric Norman commented on SLING-9991:
------------------------------------

[~cziegeler] I can't speak to whether this has worked in the past.  But in the 
current sling 12 starter, of the 4 ":sendError=true" combinations of inputs, 
only 1 of them works correctly (as described below).  My proposed fix for 
SLING-10006 corrects the #2 and #4 problems if you wish to review the proposed 
changes.

 

1) expect html response, :sendError=true and the operation was not successful

 
{code:java}
curl -i -F:sendError="true" -F:nameHint="test" -Ftext="some body text content" 
http://localhost:8080/content{code}
 

{color:#00875a}The result here appears to be correct as the 'not modifiable' 
error is sent passed off to the DefaultErrorHandlerServlet.{color}

 

2) expect html response, :sendError=true and the operation was successful

 
{code:java}
curl -i -F:sendError="true" -F:nameHint="test" -Ftext="some body text content" 
http://admin:admin@localhost:8080/content{code}
 

{color:#de350b}The result here is not correct as a NullPointerException is 
thrown while it attempts to render the success response from the 
template.{color}

 

3) expect json response, :sendError=true and the operation was not successful

 
{code:java}
curl -i -H "Accept: application/json" -F:sendError="true" -F:nameHint="test" 
-Ftext="some body text content" http://localhost:8080/content{code}
{color:#de350b}The result here is not correct as it returns an html response 
instead of json when the error handling is passed on to the default sling error 
handler.  Seems like the DefaultErrorHandlerServlet should be enhanced to 
properly consider the 'Accept' header conditions.{color}  

 

4) expect json response, :sendError=true and the operation was successful

 
{code:java}
curl -i -H "Accept: application/json" -F:sendError="true" -F:nameHint="test" 
-Ftext="some body text content" http://admin:admin@localhost:8080/content{code}
{color:#de350b}The result here is not correct as an html response is 
returned.{color}

 

 

> Parameter ":sendError"  uses/significance should be listed in the sling 
> document
> --------------------------------------------------------------------------------
>
>                 Key: SLING-9991
>                 URL: https://issues.apache.org/jira/browse/SLING-9991
>             Project: Sling
>          Issue Type: Improvement
>            Reporter: Akanksha Jain
>            Assignee: Carsten Ziegeler
>            Priority: Minor
>
> The parameter ":sendError" is used by the sling error handler to delegate 
> HTTP Post response to the custom error handler.
> This Parameter should be listed in the document[0], along with other special 
> parameters for better understanding.
> [0]: 
> https://sling.apache.org/documentation/bundles/manipulating-content-the-slingpostservlet-servlets-post.html#special-parameters-1



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to