Package org.richfaces.exception

Examples of org.richfaces.exception.FileUploadException


                readNext();
            }
        } catch (IOException e) {
            this.cancel();

            throw new FileUploadException(MessageFormat.format("Exception parsing multipart request: {0}", e.getMessage()), e);
        }
    }
View Full Code Here


    }

    private void initialize() throws IOException, FileUploadException {
        this.boundaryMarker = getBoundaryMarker(request.getContentType());
        if (this.boundaryMarker == null) {
            throw new FileUploadException("The request was rejected because no multipart boundary was found");
        }

        if (HYPHENS.length + boundaryMarker.length + CHUNK_SIZE + CR_LF.length > BUFFER_SIZE) {
            throw new FileUploadException("Boundary marker is too long");
        }

        this.sequenceMatcher = new ByteSequenceMatcher(new ProgressServletInputStream(request.getInputStream()), BUFFER_SIZE);

        readProlog();
View Full Code Here

    public byte[] getData() {
        long size = getSize();

        if (size > Integer.MAX_VALUE) {
            throw new FileUploadException("Resource content is too long to be allocated as byte[]");
        }

        InputStream is = null;
        try {
            is = getInputStream();
            return StreamUtils.toByteArray(is);
        } catch (IOException e) {
            throw new FileUploadException(e.getMessage(), e);
        } finally {
            try {
                if (is != null) {
                    is.close();
                }
View Full Code Here

                files = (List<UploadedFile>) multipartRequest.getUploadedFiles();
            }
            return files;
        } catch (Exception e) {
            context.setResponseStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
            throw new FileUploadException("couldn't parse request parts", e);
        }
    }
View Full Code Here

                readNext();
            }
        } catch (IOException e) {
            this.cancel();

            throw new FileUploadException(MessageFormat.format("Exception parsing multipart request: {0}", e.getMessage()), e);
        }
    }
View Full Code Here

    }

    private void initialize() throws IOException, FileUploadException {
        this.boundaryMarker = getBoundaryMarker(request.getContentType());
        if (this.boundaryMarker == null) {
            throw new FileUploadException("The request was rejected because no multipart boundary was found");
        }

        if (HYPHENS.length + boundaryMarker.length + CHUNK_SIZE + CR_LF.length > BUFFER_SIZE) {
            throw new FileUploadException("Boundary marker is too long");
        }

        this.sequenceMatcher = new ByteSequenceMatcher(progressControl.wrapStream(request.getInputStream()), BUFFER_SIZE);

        readProlog();
View Full Code Here

    public byte[] getData() {
        long size = getSize();

        if (size > Integer.MAX_VALUE) {
            throw new FileUploadException("Resource content is too long to be allocated as byte[]");
        }

        InputStream is = null;
        try {
            is = getInputStream();
            byte[] result = new byte[(int) size];
            ByteStreams.readFully(is, result);
            return result;
        } catch (IOException e) {
            throw new FileUploadException(e.getMessage(), e);
        } finally {
            Closeables.closeQuietly(is);
        }
    }
View Full Code Here

TOP

Related Classes of org.richfaces.exception.FileUploadException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.