[Jersey] Re: how to upload large file more then 2 gb using jersey?

From: Vipin.nemade <>
Date: Tue, 14 Feb 2012 22:02:45 -0800 (PST)

Hi Pavel,

I am using jersey multipart jar to upload a server is crashing when
file 2gb or more then 2gb.

my code of rest webservice:-

public Response uploadFile(@FormDataParam('file')InputStream
uploadedInputStream,_at_FormDataParam('file') FormDataContentDisposition
fileDetail,_at_HeaderParam("Content-Length") int length) {

                       if(uploadedInputStream != null)
                        println("contain stream")
                        if(fileDetail != null)
                        println("contain file :"+fileDetail.getFileName())
                        String name = getFileName(fileDetail.getFileName())
                        println("File Name is:"+" "+name)
                        String uploadedFileLocation = "D://uploaded/"+name;
                        String output = "File uploaded to : " + uploadedFileLocation;
                        return Response.status(200).entity("uploadFile size"+" "+length+"bytes"+"
"+"Uploaded file name : " +name).build();


        // save uploaded file to new location
        private void writeToFile(InputStream uploadedInputStream,String
uploadedFileLocation) {
                try {
                        OutputStream out = new FileOutputStream(new File(uploadedFileLocation));
                        int read = 0;
                        byte[] bytes = new byte[1024];
                        out = new FileOutputStream(new File(uploadedFileLocation));
                        while ((read = != -1) {
                } catch (IOException e) {

Please help me to achive more then 2 gb file.

View this message in context:
Sent from the Jersey mailing list archive at