[ 
https://issues.apache.org/jira/browse/CXF-8554?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Henri ENEE updated CXF-8554:
----------------------------
    Description: 
I need to get the attachments map, but the first attachment is still empty. 
I think the issue comes from the method 
org.apache.cxf.jaxrs.ext.MessageContextImpl.createAttachments line 292
The first attachment is loaded with the following method 
"inMessage.getContent(InputStream.class)"
but the InputStream is not buffered and so I think when i want to read this 
value later in my code, the stream is closed and I get an empty string.

 
@POST
@Path("")
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Description("Create a task")
public void createTask(
        @Multipart(value = "title", type = "text/plain", required = false) 
final String title,
        @Multipart(value = "description", type = "text/plain", required = 
false) final String descriptionc) throws MatrixException {

        final MultivaluedMap<String, String> attachmentMap = 
AttachmentUtils.populateFormMap(mc);
        System.out.println("The set is: " + attachmentMap.entrySet());
        // The set is: [title=[], description=[ggtegeergregregregre]]
}_
 

  was:
I need to get the attachments map, but the first attachment is still empty. 
I think the issue comes from the method 
org.apache.cxf.jaxrs.ext.MessageContextImpl.createAttachments line 292
The first attachment is loaded with the following method 
"inMessage.getContent(InputStream.class)"
but the InputStream is not bufferd and so I think when i want to read this 
value later in my code, the stream is closed and I get an empty string.

 
@POST
@Path("")
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Description("Create a task")
public void createTask(
        @Multipart(value = "title", type = "text/plain", required = false) 
final String title,
        @Multipart(value = "description", type = "text/plain", required = 
false) final String descriptionc) throws MatrixException {

        final MultivaluedMap<String, String> attachmentMap = 
AttachmentUtils.populateFormMap(mc);
        System.out.println("The set is: " + attachmentMap.entrySet());
        // The set is: [title=[], description=[ggtegeergregregregre]]
}_
 


> org.apache.cxf.jaxrs.ext.MessageContextImpl.createAttachments first 
> attachment input stream is null
> ---------------------------------------------------------------------------------------------------
>
>                 Key: CXF-8554
>                 URL: https://issues.apache.org/jira/browse/CXF-8554
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 3.3.6
>            Reporter: Henri ENEE
>            Priority: Blocker
>
> I need to get the attachments map, but the first attachment is still empty. 
> I think the issue comes from the method 
> org.apache.cxf.jaxrs.ext.MessageContextImpl.createAttachments line 292
> The first attachment is loaded with the following method 
> "inMessage.getContent(InputStream.class)"
> but the InputStream is not buffered and so I think when i want to read this 
> value later in my code, the stream is closed and I get an empty string.
>  
> @POST
> @Path("")
> @Consumes(MediaType.MULTIPART_FORM_DATA)
> @Description("Create a task")
> public void createTask(
>       @Multipart(value = "title", type = "text/plain", required = false) 
> final String title,
>       @Multipart(value = "description", type = "text/plain", required = 
> false) final String descriptionc) throws MatrixException {
>       final MultivaluedMap<String, String> attachmentMap = 
> AttachmentUtils.populateFormMap(mc);
>       System.out.println("The set is: " + attachmentMap.entrySet());
>       // The set is: [title=[], description=[ggtegeergregregregre]]
> }_
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to