I am getting ClientHandlerException when I try to retrieve the request
body(getEntity) from the ClientResponse as a Multipart object
ClientResponse.getEntity(Multipart.class)
Stack Trace:
com.sun.jersey.api.client.ClientHandlerException: A message body reader for
Java class com.sun.jersey.multipart.MultiPart, and Java type class
com.sun.jersey.multipart.MultiPart, and MIME media type
multipart/mixed;boundary=Boundary_12_5848842_1305116722324 was not found
at
com.sun.jersey.api.client.ClientResponse.getEntity(ClientResponse.java:548)
at
com.sun.jersey.api.client.ClientResponse.getEntity(ClientResponse.java:505)
at ....
Even getting as a String object fails(IOException - Stream is closed).
However, getting status, getting entity as Input Stream all works fine.
This issue is occuring since the jersey and related jars were upgraded from
1.1.2 to 1.5.
Not sure if I am something missing.
Code Snippet:
ClientResponse clientResponse =
addHeaders(service.path(retrieveURI).getRequestBuilder()).get(ClientResponse.class);
assertEquals(200, clientResponse.getStatus());
System.out.println(clientResponse.hasEntity());
System.out.println(clientResponse.getEntityTag());
try {
System.out.println(convertStreamToString(clientResponse.getEntityInputStream()));
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println(clientResponse.getEntity(String.class));
MultiPart multiPart = (MultiPart) clientResponse.getEntity(MultiPart.class);
--
View this message in context: http://jersey.576304.n2.nabble.com/Jersey-1-5-ClientHandlerException-ClientResponse-getEntity-Multipart-class-tp6354471p6354471.html
Sent from the Jersey mailing list archive at Nabble.com.