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

Ankit Agarwal commented on SLING-5866:
--------------------------------------

[~bdelacretaz] Thanks for updating HeadServletTest. I have update TestCase a 
litte bit after that test cases are getting passed.

Regarding  
"the null tests are inverted between getWriter and getOutputStream, "

as mentioned at [2]
 "Either this method or getWriter() may be called to write the body, not both." 
So IMO, null test should be fine here . 
Moreover this is same as already done in sling DefaultHeadServlet [3].
I have mentioned same in git pull request.

[2] 
http://docs.oracle.com/javaee/5/api/javax/servlet/ServletResponse.html#getOutputStream()
[3] 
https://github.com/apache/sling/blob/trunk/bundles/servlets/get/src/main/java/org/apache/sling/servlets/get/impl/DefaultHeadServlet.java#L133
 

Please let me know anything else need to be updated in pull request.

thanks,

> DefaultGetServlet obtains input stream for binary even if request is a HEAD
> ---------------------------------------------------------------------------
>
>                 Key: SLING-5866
>                 URL: https://issues.apache.org/jira/browse/SLING-5866
>             Project: Sling
>          Issue Type: Improvement
>          Components: Servlets
>    Affects Versions: Servlets Get 2.1.14
>            Reporter: Ankit Agarwal
>
> As per current implementation any HEAD request will be handled by 
> defaultHeadServlet which majorly does two changes
> 1.) coverts response output stream to be null so that there should be no 
> message body in response
> 2.)  coverts HEAD request to GET request. 
> Now this request is dispatched and served by defaultGetServlet.
> With this approach, we get the desired output but response is delayed as it 
> reads the complete binary data of a resource. and also it increases data 
> transfer which is not needed.
> So IMO this approach should be improved.
> thanks,



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to