Hi

Can you please experiment with accepting it directly as InputStream:

@Consumes(MediaType.MULTIPART_FORM_DATA)
> @Produces(MediaType.APPLICATION_JSON)
> public Response saveFile(
>        @PathParam(“name") String name,
>        InputStream body,
>        @HeaderParam("CUSTOM-uid") String username);

If the whole body is indeed available then saving this InputStream will show the complete multipart request (with the part separators, etc)

As a side note,
> for(Attachment attachment : body.getAllAttachments()) {
>      … // how I get the input stream
>      is = attachment.getDataHandler().getInputStream();

instead you can do

is = attachment.getObject(InputStream.class);
or directly from the multipart body if a part id is known.

Sergey

On 26/04/16 19:20, Chris Bud wrote:
Hi,

I'm using CXF 3.0.3, uploading files to jaxrs service from my webapp.
Small files upload fine but when I use files > 300KB they're empty on my
server, in my case I'm uploading an XML document containing test info for
my system.  When I test for available bytes from the data handler's input
stream, it's always empty. Not the case with small files, say 500B.
Regardless of size, the service returns a success.

My LoggingInInterceptor spits out a payload that is incomplete, but the
POST in firebug shows the entire file contents. I feel like I'm missing
some sort of config, I've read about MTOM but I don't think 300KB should be
a problem.... What am I missing? Thanks for helping

My service interface
@POST
@Path(“/save/{name}")
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces(MediaType.APPLICATION_JSON)
public Response saveFile(
       @PathParam(“name") String name,
       @Multipart MultipartBody body,
       @HeaderParam("CUSTOM-uid") String username);

...
for(Attachment attachment : body.getAllAttachments()) {
     … // how I get the input stream
     is = attachment.getDataHandler().getInputStream();

Bean definition
<jaxrs:server id=“wserver" address="/">
    <jaxrs:serviceBeans>
       <bean class=“example.com.web.rs.impl.FileServiceImpl" />
       ...
    </jaxrs:serviceBeans>
    <jaxrs:providers>
       <bean class="org.codehaus.jackson.jaxrs.JacksonJsonProvider" />
    </jaxrs:providers>
    <jaxrs:features>
       <ref bean="logger" />
    </jaxrs:features>


</jaxrs:server>


Reply via email to