Hi
On 10/07/13 15:11, jamalissimo wrote:
Hello guys,

I am working on file upload via CXF and I have little problem.
Here is the REST part:

        @POST
        @Consumes(MediaType.MULTIPART_FORM_DATA)
        @Path("/upload")
        @Produces(MediaType.APPLICATION_JSON)
        public Response uploadFile(
                @Multipart("document") byte[] document,
                @Multipart("product") String product,
                @Multipart("uploader") String uploader,
                @Multipart("folderId") String folderId)
                throws IOException {

                return null;
        }

Problem is, that I need somehow to get the name of the file, but I am not
sure if it is possible from byte[].
use 'org.apache.cxf.jaxrs.ext.multipart.Attachment' data type instead of byte[], you can check headers like Content-Disposition, and then do

attachment.getObject(InputStream.class)

Cheers, Sergey

I am using Karaf 2.3.1

Thanks for help

-Roman



-----
-Br, Roman
--
View this message in context: 
http://cxf.547215.n5.nabble.com/Multipart-file-upload-tp5730547.html
Sent from the cxf-user mailing list archive at Nabble.com.



--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com

Reply via email to