cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sergey Beryozkin (JIRA)" <>
Subject [jira] Commented: (CXF-3399) When using ResponseBuilder to create Response of multiparts, the boundary attribute in the Content-Type Header is missing
Date Tue, 15 Mar 2011 10:15:29 GMT


Sergey Beryozkin commented on CXF-3399:


It only convinces me you have a more complex case compared to the ones which are being tested
in multipart tests in CXF. I've updated another test which returns MultipartBody by wrapping
it in Response and not setting the content-type explicitly and I can see Content-Type printed
on the client side...

At this stage I do need your help. 
set a breakpoint in org.apache.cxf.jaxrs.provider.MultipartProvider writeTo method and I'm
sure you'll spot something. Alternatively attach a sample project which does not have to match
the real code/configuration used in your project but just follow the same structure...

thanks, Sergey

> When using ResponseBuilder to create Response of multiparts, the boundary attribute in
the Content-Type Header is missing
> -------------------------------------------------------------------------------------------------------------------------
>                 Key: CXF-3399
>                 URL:
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.3.3
>         Environment: XP 2002 SP-3, JDK, cxf-2.3.3, 
>            Reporter: Avshalom Yeshurun
>              Labels: Boundary, Content-Type, ResponseBuilder
>   Original Estimate: 672h
>  Remaining Estimate: 672h
> Hello,
> We have implemented the following method while the output of the Response should be a
multipart message.
>     @POST
>     @Path("{destinationAddress}/messages/payloads")
>     @Consumes("application/xml")
>     @Produces({"multipart/related", "multipart/mixed", "multipart/form-data"})    
>     public Response postMailboxMessagesPayloadRequest(@Context HttpServletRequest request,
>  						   @PathParam("destinationAddress") String destinationAddress,
>  						   @Context ServletContext servletContext,
>  						   JAXBElement<MailboxMessagesPayload> jAXBElement) {
> 		try{
> 				List<Attachment> attachments = ((MultipartBody)mwMailboxMessagesPayloadResponse.getBody()).getAllAttachments();
> 				MultipartBody multipartBody = new MultipartBody(attachments);
> 				ResponseBuilder responseBuilder = Response.status(HttpURLConnection.HTTP_OK);
> 				responseBuilder.type(multipartBody.getType()
> 				responseBuilder.entity(multipartBody);
> 				Response response =;
> 				return response;   
> 		}
> 		catch(Exception e){
> 		}
> The thing is that no matter what we do, we can not have the 'boundary' which is determined
by the CXF engine to appear in the Content-Type on the main header.
> As a result no Client will be able to parse the returned message.
> If we try to manually set the Content-Type header while giving it our own 'boundary',
the result is that a different boundary is generated for the actual message, while the boundary
we set is not the same.

This message is automatically generated by JIRA.
For more information on JIRA, see:

View raw message