-
February 2nd, 2014, 11:03 AM
#1
How do i post a byte array via REST (jax rs servlet)?
This is the servlet:
@Path("/conf")
public class JaxRsServlet {
@POST
@Path("/create")
@Consumes("*/*") // to accept all input types
public String createFile(byte[] data) {
//business logic
}
}
This is the call to the servlet:
public byte[] doPOST2(byte[] data) {
Resource resource = restClient.resource(this.url);
ClientResponse response = resource.contentType(MediaType.APPLICATION_OCTET_STREAM).accept("*/*").post(data);
return null;
}
The byte array represents a list of XML strings which i serialized using apache SerializationUtils.
When i invoke this post API, the binding fails with following exception:
"com.sun.jdi.InvalidTypeException occurred invoking method."
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|