jetbrick-webmvc/src/main/java/jetbrick/web/mvc/multipart/FileUploaderUtils.java
private static MultipartRequest asHtml5Request(HttpServletRequest request) throws Exception {
        String originalFilename = request.getHeader("content-disposition");
        if (originalFilename == null) {
            throw new ServletException("The request is not a html5 file upload request.");
        }
        originalFilename = new String(originalFilename.getBytes("iso8859-1"), request.getCharacterEncoding());
        originalFilename = StringUtils.substringAfter(originalFilename, "; filename=");
        originalFilename = StringUtils.remove(originalFilename, "\"");
        originalFilename = URLDecoder.decode(originalFilename, "utf-8");

        File diskFile = getTempFile(originalFilename);

        InputStream fis = request.getInputStream();
        OutputStream fos = new FileOutputStream(diskFile);
        try {
            IoUtils.copy(fis, fos);
        } finally {
            IoUtils.closeQuietly(fis);
            IoUtils.closeQuietly(fos);
        }

        MultipartRequest req = new MultipartRequest(request);
        FilePart filePart = new FilePart("file", originalFilename, diskFile);
        req.addFile(filePart);
        return req;
    }
private static MultipartRequest asHtml5Request(HttpServletRequest request) throws Exception {
        String originalFilename = request.getHeader("content-disposition");
        if (originalFilename == null) {
            throw new ServletException("The request is not a html5 file upload request.");
        }
        originalFilename = new String(originalFilename.getBytes("iso8859-1"), request.getCharacterEncoding());
        originalFilename = StringUtils.substringAfter(originalFilename, "; filename=");
        originalFilename = StringUtils.remove(originalFilename, "\"");
        originalFilename = URLDecoder.decode(originalFilename, "utf-8");

        File diskFile = getTempFile(originalFilename);

        InputStream fis = request.getInputStream();
        OutputStream fos = new FileOutputStream(diskFile);
        try {
            IoUtils.copy(fis, fos);
        } finally {
            IoUtils.closeQuietly(fis);
            IoUtils.closeQuietly(fos);
        }

        MultipartRequest req = new MultipartRequest(request);
        FilePart filePart = new FilePart("file", originalFilename, diskFile);
        req.addFile(filePart);
        return req;
    }
private static MultipartRequest asHtml5Request ( HttpServletRequest request ) throws Exception { String originalFilename = request . getHeader ( "content-disposition" ) ; if ( originalFilename == null ) { throw new ServletException ( "The request is not a html5 file upload request." ) ; } originalFilename = new String ( originalFilename . getBytes ( "iso8859-1" ) , request . getCharacterEncoding ( ) ) ; originalFilename = StringUtils . substringAfter ( originalFilename , "; filename=" ) ; originalFilename = StringUtils . remove ( originalFilename , "\"" ) ; originalFilename = URLDecoder . decode ( originalFilename , "utf-8" ) ; File diskFile = getTempFile ( originalFilename ) ; InputStream fis = request . getInputStream ( ) ; OutputStream fos = new FileOutputStream ( diskFile ) ; try { IoUtils . copy ( fis , fos ) ; } finally { IoUtils . closeQuietly ( fis ) ; IoUtils . closeQuietly ( fos ) ; } MultipartRequest req = new MultipartRequest ( request ) ; FilePart filePart = new FilePart ( "file" , originalFilename , diskFile ) ; req . addFile ( filePart ) ; return req ; }
application/octet-stream
application / octet - stream