I'm seeing an issue posting body with CXF-RS 3.1.0 HTTP POST, what happens is
that if I add an attachment with the same content-type (application/json) as
that of the body, both the entity body and the attachment content are
combined.
E.g. Entity body: TEST ME.
Attachment Content: This is an attachment.
Parameter value in the method below: *TEST ME. HTTP Headers and then the
attachment content(This is an attachment). *Also, if I do not pass the body
but POST an attachment, the content of the attachment (application/json) is
passed into the parameter requestBody below. Looks like its bug.
@Path("/{someResource}")
@POST
@Consumes(MediaType.APPLICATION_JSON)
@Produces({MediaType.APPLICATION_XML,MediaType.APPLICATION_JSON})
processRequest( String requestBody);
I'm ideally looking to ignore all attachments and throw some HTTP 4XX code,
is there way to do it?
Below is a sample request, POSTed to the service, where the first part is
in request body while the second part in the request attachment.
The service received the body and message together as a string as below:
Note:
Sample: ------=_Part_27_985990731.1443486850771
Content-Type: application/json
Content-Transfer-Encoding: 8bit
This is a test to understand why message body and attachment are passed
together.
------=_Part_27_985990731.1443486850771
Content-Type: application/json; name=JSONTEST.txt
Content-Transfer-Encoding: binary
Content-ID: <apimessage>
Content-Disposition: attachment; name="JSONTEST.txt";
filename="JSONTEST.txt"
{
"SomeRequest": {
"requestType": {
"aaId": "1",
"bbtId": "6",
"ccId": "8",
"fname": "fname",
"lname": "lname",
"address": "address1",
"country": "USA"
}
}
}
------=_Part_27_985990731.1443486850771--
http://stackoverflow.com/questions/32827616/cxf-rs-combining-body-and-attachment
--
View this message in context:
http://cxf.547215.n5.nabble.com/CXF-RS-3-1-0-combining-body-and-attachment-tp5761361.html
Sent from the cxf-user mailing list archive at Nabble.com.