cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Avshalom Yeshurun (JIRA)" <j...@apache.org>
Subject [jira] Commented: (CXF-3399) When using ResponseBuilder to create Response of multiparts, the boundary attribute in the Content-Type Header is missing
Date Mon, 14 Mar 2011 15:04:30 GMT

    [ https://issues.apache.org/jira/browse/CXF-3399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13006450#comment-13006450
] 

Avshalom Yeshurun commented on CXF-3399:
----------------------------------------


Hello Sergey,

Thank you for your quick reply. I appreciate it a lot.

I have tried to set the @Produces annotation to the option you have suggested below and the
result was the same.
Actually, I have tried to set all kinds of values for the @Produces annotation, but all gave
the same result.

Somehow, the ResponseBuilder builds the message correctly except the boundary which is missing
in the Content-Type header.

If there was a way to somehow know in advance the value the CXF uses for the boundary, then
it will be possible to solve this problem, since I will be able to manually set the boundary
which is the one the CXF engine uses.

BR,
Avish


ן»¿

Avish Yeshurun

Comverse ג€“ Making Your Network Smarter

T   +972-3-7663737
M +972-52-8543738
Avshalom.Yeshurun@comverse.com


P Please think of the environment before printing this email




> When using ResponseBuilder to create Response of multiparts, the boundary attribute in
the Content-Type Header is missing
> -------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CXF-3399
>                 URL: https://issues.apache.org/jira/browse/CXF-3399
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.3.3
>         Environment: XP 2002 SP-3, JDK 1.6.0.17, 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 = responseBuilder.build();
> 				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: http://www.atlassian.com/software/jira

Mime
View raw message