Hi,
when looking at the MultiPart javadoc [1], it reads:
--8<--
Note that, per the MIME specifications, only headers that match
|Content-*| should be included on a |BodyPart|
<
http://jersey.java.net/nonav/apidocs/latest/contribs/jersey-multipart/com/sun/jersey/multipart/BodyPart.html>
-->8--
Do you see any log message suggesting your header was refused?
Any chance to try with a different header name?
~Jakub
[1]
http://jersey.java.net/nonav/apidocs/latest/contribs/jersey-multipart/com/sun/jersey/multipart/BodyPart.html#getHeaders%28%29
On 20.10.2011 2:02, tiptronicus_at_gmail.com wrote:
> I am trying to send an additional header param in a multipart message
> as follows in a Jersey client program
>
> MultiPart multipart = createMultiPartMessage();
> multipart.getHeaders().putSingle("newtoken",
> UUID.randomUUID().toString());
>
> ClientResponse response =
> webResource.path("/send").accept("application/json").type("multipart/mi
> xed").post(ClientResponse.class, multipart);
>
> The upload works fine. But on the server when I try to print the
> headers of the multipart, I don't see this key. The code is like this
>
> @POST
> @Path("/send")
> @Consumes("multipart/mixed")
> @Produces("application/json")
> public Response uploadData(MultiPart multipart) {
>
> System.out.println(multipart.getHeaders().toString());
>
>
> and the result looks like this
>
> {accept=[application/json], content-type=[multipart/mixed;
> boundary=Boundary_1_986957475_1319068022450], mime-version=[1.0],
> user-agent=[Java/1.6.0_27], host=[localhost:8080],
> connection=[keep-alive], content-length=[4845778]}
>
> If this is not the right way to pass a custom header, what is?
>
> Thanks,
>