cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sergey Beryozkin (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CXF-5167) HEAD operation implementation is not compliant with specification
Date Tue, 30 Jul 2013 10:37:49 GMT

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

Sergey Beryozkin commented on CXF-5167:
---------------------------------------

Oh, you mean you need Content-Length and Content-Type preserved in response to HEAD...Let
me double check on that
                
> HEAD operation implementation is not compliant with specification
> -----------------------------------------------------------------
>
>                 Key: CXF-5167
>                 URL: https://issues.apache.org/jira/browse/CXF-5167
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.7.5
>            Reporter: Antonio Sargento
>
> The implementation of HEAD operation is not compliant with the HTTP 1.1 specification.
> {quote}
> 9.4 HEAD
> The HEAD method is identical to GET except that the server MUST NOT return a message-body
in the response. The metainformation contained in the HTTP headers in response to a HEAD request
SHOULD be identical to the information sent in response to a GET request. This method can
be used for obtaining metainformation about the entity implied by the request without transferring
the entity-body itself. This method is often used for testing hypertext links for validity,
accessibility, and recent modification.
> The response to a HEAD request MAY be cacheable in the sense that the information contained
in the response MAY be used to update a previously cached entity from that resource. If the
new field values indicate that the cached entity differs from the current entity (as would
be indicated by a change in Content-Length, Content-MD5, ETag or Last-Modified), then the
cache MUST treat the cache entry as stale.
> {quote}
> Now, since the HEAD response doesn't have an body entity, the Content-lenght is equal
to zero and the mime-type is set to text/plain.
> I think that the problem is due the following code in class org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor
(lines 228 - 236) 
> {code}
> // Write the entity
> entity = InjectionUtils.getEntity(response.getEntity());
> setResponseStatus(message, getActualStatus(response.getStatus(), entity));
> if (entity == null) {
>    responseHeaders.putSingle(HttpHeaders.CONTENT_LENGTH, "0");
>    responseHeaders.remove(HttpHeaders.CONTENT_TYPE);
>    message.remove(Message.CONTENT_TYPE);
>    return;
> }
> {code}
>  

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message