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 BF18C104C2 for ; Mon, 7 Apr 2014 23:34:21 +0000 (UTC) Received: (qmail 15532 invoked by uid 500); 7 Apr 2014 23:34:19 -0000 Delivered-To: apmail-cxf-issues-archive@cxf.apache.org Received: (qmail 15401 invoked by uid 500); 7 Apr 2014 23:34:18 -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 15242 invoked by uid 99); 7 Apr 2014 23:34:17 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 07 Apr 2014 23:34:17 +0000 Date: Mon, 7 Apr 2014 23:34:17 +0000 (UTC) From: "Sergey Beryozkin (JIRA)" To: issues@cxf.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CXF-5675) java.lang.ClassCastException: java.net.URI cannot be cast to java.lang.String when adding Location to Response 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-5675?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13962388#comment-13962388 ] Sergey Beryozkin commented on CXF-5675: --------------------------------------- Hi, I wonder how the client runtime ends up seeing a headers Map where the values may not be Strings, just curious. Do you use AsyncConduit, may be HttpClient translates Location values to URI ? Cheers, Sergey > java.lang.ClassCastException: java.net.URI cannot be cast to java.lang.String when adding Location to Response > -------------------------------------------------------------------------------------------------------------- > > Key: CXF-5675 > URL: https://issues.apache.org/jira/browse/CXF-5675 > Project: CXF > Issue Type: Bug > Components: JAX-RS > Affects Versions: 3.0.0-milestone2 > Reporter: David J. M. Karlsen > > Exception: > java.lang.ClassCastException: java.net.URI cannot be cast to java.lang.String > Test: > {code} > Response response = getWebClient() > .path("/blob") > .type(MediaType.MULTIPART_FORM_DATA) > .post(multipartBody); > {code} > serverside resource: > {code} > URI blobId = UriBuilder.fromResource(getClass()).build(gridFSDBFile.getId()); > return Response.created(blobId).build(); > {code} > because inside WebClient handleResponse -> AbstractClient the values are assumed to be string arrays, but is an URI object: > {code} > boolean splitHeaders = > MessageUtils.isTrue(outMessage.getContextualProperty(HEADER_SPLIT_PROPERTY)); > for (Map.Entry> entry : protocolHeaders.entrySet()) { > if (null == entry.getKey()) { > continue; > } > if (entry.getValue().size() > 0) { > if (HttpUtils.isDateRelatedHeader(entry.getKey())) { > currentResponseBuilder.header(entry.getKey(), entry.getValue().get(0)); > continue; > } > for (String val : entry.getValue()) { > if (splitHeaders) { > String[] values; > if (val == null || val.length() == 0) { > {code} -- This message was sent by Atlassian JIRA (v6.2#6252)