users@jersey.java.net

Re: [Jersey] Multipart 1.0.3 not finding message body reader

From: Ari Heino <ext.ari.heino_at_tieto.com>
Date: Wed, 22 Apr 2009 02:55:46 -0700 (PDT)

Paul Sandoz wrote:
>
> Hi,
>
> What you present below should work, although i recommend utilizing:
>
> multiPart.getBodyParts().get(1).getEntityAs(InputStream.class);
>
> The functionality to get access to the input stream is fundamental to
> the higher-level operations with @FormDataParam. We have a number of
> unit tests that would fail if the available content was zero.
>
I am not using @FormDataParam, since I'm using @Consumes("multipart/mixed").
Or should i still use @FormDataParam somewhere in my code? Here's the method
signatur that receives Multipart:

    @POST
    @Consumes(MultiPartMediaTypes.MULTIPART_MIXED)
    public Response addRevision(MultiPart multiPart) {
    }


> How is the multipart message produced? using the Jersey client API?
>
Yes. Here's example of the client side:
            VersionContentDto dto = new VersionContentDto();
            dto.setName("name");

            byte[] byteArray = "content test text that does
stuph".getBytes();
            ByteArrayInputStream bis = new ByteArrayInputStream(byteArray);

            MultiPart multiPartInput = new MultiPart().bodyPart(new
BodyPart(dto, MediaType.APPLICATION_XML_TYPE))
                .bodyPart(new BodyPart(bis,
MediaType.APPLICATION_OCTET_STREAM_TYPE));

            r = content.type(
               
MultiPartMediaTypes.MULTIPART_MIXED).post(ClientResponse.class,
multiPartInput);


> Would it be possible to send a complete reproducible test case as a
> maven project?
>
We're not using Maven in this project.


> Paul.
>
>

-- 
View this message in context: http://n2.nabble.com/Multipart-1.0.3-not-finding-message-body-reader-tp2668407p2675182.html
Sent from the Jersey mailing list archive at Nabble.com.