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 1A44A18CB5 for ; Wed, 12 Aug 2015 12:27:46 +0000 (UTC) Received: (qmail 57265 invoked by uid 500); 12 Aug 2015 12:27:46 -0000 Delivered-To: apmail-cxf-issues-archive@cxf.apache.org Received: (qmail 57220 invoked by uid 500); 12 Aug 2015 12:27:46 -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 57206 invoked by uid 99); 12 Aug 2015 12:27:45 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 12 Aug 2015 12:27:45 +0000 Date: Wed, 12 Aug 2015 12:27:45 +0000 (UTC) From: "metatech (JIRA)" To: issues@cxf.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CXF-6528) JAX-RS "lastModified" generates timestamp with non-standard format 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-6528?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14693405#comment-14693405 ] metatech commented on CXF-6528: ------------------------------- Hi Sergey, Yes, you guessed it right, we are using it with a Camel CXF Transport. {code} at com.mycompany.myproject.MyRestService$1.toString(MyRestService.java:153) at org.apache.camel.impl.converter.ToStringTypeConverter.convertTo(ToStringTypeConverter.java:61) at org.apache.camel.impl.converter.BaseTypeConverterRegistry.doConvertTo(BaseTypeConverterRegistry.java:316) at org.apache.camel.impl.converter.BaseTypeConverterRegistry.convertTo(BaseTypeConverterRegistry.java:114) at org.apache.camel.impl.converter.BaseTypeConverterRegistry.convertTo(BaseTypeConverterRegistry.java:99) at org.apache.camel.core.osgi.OsgiTypeConverter.convertTo(OsgiTypeConverter.java:111) at org.apache.camel.component.http.DefaultHttpBinding.doWriteResponse(DefaultHttpBinding.java:286) at org.apache.camel.component.http.DefaultHttpBinding.writeResponse(DefaultHttpBinding.java:231) {code} As a workaround, I defined my own Date sub-type (class "$1" in the stack trace) in my REST class, on which I have overridden the "toString()" method, in which I convert it explicitly in the date format used in the old "toHttpDate" method, and now it works fine. For a more generic solution, I guess that the Camel DefaultHttpBinding could do a custom conversion for this HTTP header instead of using the generic TypeConverter's present in the registry. But this sounds like "ad hoc" solution... Thanks. > JAX-RS "lastModified" generates timestamp with non-standard format > ------------------------------------------------------------------ > > Key: CXF-6528 > URL: https://issues.apache.org/jira/browse/CXF-6528 > Project: CXF > Issue Type: Bug > Components: JAX-RS > Affects Versions: 3.0.0-milestone2 > Environment: ServiceMix 5.4.0 > Reporter: metatech > > In CXF 3.x (since CXF-5007), the date format has changed in the "Last-Modified" HTTP header generated by JAX-RS. > In class org.apache.cxf.jaxrs.impl.ResponseBuilderImpl, the method "lastModified()" does not call the "toHttpDate" anymore. > The format is now the default format used when calling "toString" on the date object. > This format is not one of the 3 allowed by the HTTP specification (RFC2616, section 3.3.1). > For instance, an HTTPClient will reject this date format : > ==================== > Wrong date format for date Wed Aug 12 08:18:54 CEST 2015 > org.apache.commons.httpclient.util.DateParseException: Unable to parse the date Wed Aug 12 08:18:54 CEST 2015 > at org.apache.commons.httpclient.util.DateUtil.parseDate(DateUtil.java:170) > at org.apache.commons.httpclient.util.DateUtil.parseDate(DateUtil.java:94) > ==================== > Can you please restore the date conversion ? > Thanks in advance. -- This message was sent by Atlassian JIRA (v6.3.4#6332)