Return-Path: X-Original-To: apmail-cxf-issues-archive@www.apache.org Delivered-To: apmail-cxf-issues-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8821D10CBD for ; Tue, 30 Jul 2013 10:39:52 +0000 (UTC) Received: (qmail 73552 invoked by uid 500); 30 Jul 2013 10:39:50 -0000 Delivered-To: apmail-cxf-issues-archive@cxf.apache.org Received: (qmail 73465 invoked by uid 500); 30 Jul 2013 10:39:49 -0000 Mailing-List: contact issues-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list issues@cxf.apache.org Received: (qmail 73449 invoked by uid 99); 30 Jul 2013 10:39:49 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 30 Jul 2013 10:39:49 +0000 Date: Tue, 30 Jul 2013 10:39:49 +0000 (UTC) From: "Antonio Sargento (JIRA)" To: issues@cxf.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CXF-5167) HEAD operation implementation is not compliant with specification MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CXF-5167?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13723688#comment-13723688 ] Antonio Sargento commented on CXF-5167: --------------------------------------- The problem is that the original Content-type is removed and set the default one. > 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