David J. M. Karlsen created CXF-5675:
----------------------------------------

             Summary: 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<String, List<String>> 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)

Reply via email to