You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Avshalom Yeshurun (JIRA)" <ji...@apache.org> on 2011/03/14 15:42:29 UTC

[jira] Created: (CXF-3399) When using ResponseBuilder to create Response of multiparts, the boundary attribute in the Content-Type Header is missing

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: WS-* Components
    Affects Versions: 2.3.3
         Environment: XP 2002 SP-3, JDK 1.6.0.17, cxf-2.3.3, 
            Reporter: Avshalom Yeshurun


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

[jira] Commented: (CXF-3399) When using ResponseBuilder to create Response of multiparts, the boundary attribute in the Content-Type Header is missing

Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-3399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13006865#comment-13006865 ] 

Sergey Beryozkin commented on CXF-3399:
---------------------------------------

Hi

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. 
Download http://repo1.maven.org/maven2/org/apache/cxf/cxf-bundle/2.3.3/cxf-bundle-2.3.3-sources.jar, 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: 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

[jira] [Commented] (CXF-3399) When using ResponseBuilder to create Response of multiparts, the boundary attribute in the Content-Type Header is missing

Posted by "Avshalom Yeshurun (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-3399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13009570#comment-13009570 ] 

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

Hello Sergey,
OK from my side to close the case. I have no comments.
Thank you for all your help,
Avish

Avish Yeshurun

Comverse
Office: +972-3-7663737
Mobile: +972-52-8543738
avish.yeshurun@comverse.com





> 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
>            Assignee: Sergey Beryozkin
>              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

[jira] [Resolved] (CXF-3399) When using ResponseBuilder to create Response of multiparts, the boundary attribute in the Content-Type Header is missing

Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-3399?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sergey Beryozkin resolved CXF-3399.
-----------------------------------

    Resolution: Not A Problem
      Assignee: Sergey Beryozkin

Avish - I'm closing this issue - if you have any comments - type them here and we'll discuss them, thanks

> 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
>            Assignee: Sergey Beryozkin
>              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

[jira] Commented: (CXF-3399) When using ResponseBuilder to create Response of multiparts, the boundary attribute in the Content-Type Header is missing

Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-3399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13006652#comment-13006652 ] 

Sergey Beryozkin commented on CXF-3399:
---------------------------------------

Hi Avish

No problems, thanks for the feedback...

I think I will need a basic test project. At the very least, please attach a sample root resource and the client code doing the invocation.
The other option is to download the CXF source and debug.

I'm not quite sure why the Content-Type is null, I have few tests where multiparts are returned and it works fine.
May be you have some JAX-RS to JAX-WS bridge ?

Either way, hope we'll track down the issue soon

Cheers, Sergey

> 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

[jira] Commented: (CXF-3399) When using ResponseBuilder to create Response of multiparts, the boundary attribute in the Content-Type Header is missing

Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-3399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13006464#comment-13006464 ] 

Sergey Beryozkin commented on CXF-3399:
---------------------------------------

Hi 


I think I know what it is.

Can you just avoid setting the content type on the ResponseBuilder ?
Please do:

return Response.ok().entity(multipartBody).build();

I've done a quick test which confirms the top-level Content-Type includes the boundary when Response is returned and no content type is set explicitly. Otherwise whatever ContentType the user sets on the ResponseBuilder has to be used...

Can you please verify it ?

thanks, Sergey
 

> 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

[jira] [Commented] (CXF-3399) When using ResponseBuilder to create Response of multiparts, the boundary attribute in the Content-Type Header is missing

Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-3399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13009112#comment-13009112 ] 

Sergey Beryozkin commented on CXF-3399:
---------------------------------------

Hi Avish

Many thanks for looking into this issue and finding the solution. Let me know please if you have any comments re the way the Multipart-related code can be improved for the cases like yours be easier to deal with...

Cheers, Sergey


> 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

[jira] Commented: (CXF-3399) When using ResponseBuilder to create Response of multiparts, the boundary attribute in the Content-Type Header is missing

Posted by "Avshalom Yeshurun (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-3399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13006849#comment-13006849 ] 

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


Hello Sergey,

Mayby this will give you a hint:
When I try to avoid setting the content type on the ResponseBuilder, I get this error:

HTTP/1.1 500 Internal Server Error
No message body writer has been found for response class MultipartBody.

That is regardless of the Produces annotation.
Let me know if you still need more info.

Thanks!
Avish








> 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

[jira] Updated: (CXF-3399) When using ResponseBuilder to create Response of multiparts, the boundary attribute in the Content-Type Header is missing

Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-3399?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sergey Beryozkin updated CXF-3399:
----------------------------------

    Component/s:     (was: WS-* Components)
                 JAX-RS

Thanks for opening this issue.

At the moment CXF JAX-RS does not support writing multipart/form-data payloads.

Can you please narrow Produces to @Produces({"multipart/related", "multipart/mixed"}) only and confirm it works ?
We will try to add the support for writing multipart/form-data in time for 2.4.0/2.3.4
Cheers, Sergey

> 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

[jira] [Commented] (CXF-3399) When using ResponseBuilder to create Response of multiparts, the boundary attribute in the Content-Type Header is missing

Posted by "Avshalom Yeshurun (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-3399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13009078#comment-13009078 ] 

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

Hello Sergey,

We have managed the found the problem. It appears the problem was (indeed) in the code were the MultipartBody is build.
Thank you for your time and efforts. You have been very helpful.
BR,
Avish


Avish Yeshurun

Comverse
Office: +972-3-7663737
Mobile: +972-52-8543738
avish.yeshurun@comverse.com




> 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

[jira] Commented: (CXF-3399) When using ResponseBuilder to create Response of multiparts, the boundary attribute in the Content-Type Header is missing

Posted by "Avshalom Yeshurun (JIRA)" <ji...@apache.org>.
    [ 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

[jira] Commented: (CXF-3399) When using ResponseBuilder to create Response of multiparts, the boundary attribute in the Content-Type Header is missing

Posted by "Avshalom Yeshurun (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-3399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13006549#comment-13006549 ] 

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


Hello Sergey,
Again, thank you for your quick reply.

I did already test it, and the Content-type is null (that was our first choice).
I have tried it while not giving @Produces annotation, and while
adding:
@Produces({"multipart/related", "multipart/mixed"})

BR,
Avish



Avish Yeshurun


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