Package org.apache.commons.fileupload

Examples of org.apache.commons.fileupload.FileItemFactory


    @SuppressWarnings("unchecked")
    public void intercept(InterceptorStack stack, ResourceMethod method, Object instance)
        throws InterceptionException {
        logger.debug("Trying to parse multipart request.");

        FileItemFactory factory = createFactoryForDiskBasedFileItems(config.getDirectory());

        ServletFileUpload fileUploadHandler = new ServletFileUpload(factory);
        fileUploadHandler.setSizeMax(sizeLimit);

        try {
View Full Code Here


    public void intercept(InterceptorStack stack, ResourceMethod method, Object instance)
        throws InterceptionException {
        logger.info("Request contains multipart data. Try to parse with commons-upload.");

        FileItemFactory factory = createFactoryForDiskBasedFileItems(config.getDirectory());
        indexes = HashMultiset.create();
       
        ServletFileUpload uploader = fileUploadCreator.create(factory);
        uploader.setSizeMax(config.getSizeLimit());
View Full Code Here

public class DefaultMultipartFormParser implements MultipartFormParser {
  private static final String MULTIPART = "multipart/";

  public Collection<FormDataItem> parse(HttpServletRequest servletRequest)
      throws IOException  {
    FileItemFactory factory = new DiskFileItemFactory();
    ServletFileUpload upload = new ServletFileUpload(factory);

    try {
      @SuppressWarnings("unchecked")
      List<FileItem> fileItems = upload.parseRequest(servletRequest);
View Full Code Here

    return uploaderPlugin;
  }

  @SuppressWarnings( "unchecked" )
  private FileItem getFileItem( HttpServletRequest request, long maxFileSize ) throws FileUploadException {
    FileItemFactory factory = new DiskFileItemFactory();
    ServletFileUpload upload = new ServletFileUpload( factory );
    upload.setFileSizeMax( maxFileSize );
    List items = upload.parseRequest( request );
    Iterator it = items.iterator();
    while ( it.hasNext() ) {
View Full Code Here

     */
    private void handleMultipartForm(ActionRequest request, RequestContextIFace requestContext) throws Exception {
      SourceBean serviceRequest = requestContext.getServiceRequest();
     
      // Create a factory for disk-based file items
      FileItemFactory factory = new DiskFileItemFactory();
     
        // Create a new file upload handler
      PortletFileUpload upload = new PortletFileUpload(factory);

        // Parse the request
View Full Code Here

    private void handleMultipartForm(HttpServletRequest request, RequestContextIFace requestContext)
      throws Exception{
      SourceBean serviceRequest = requestContext.getServiceRequest();
     
      // Create a factory for disk-based file items
      FileItemFactory factory = new DiskFileItemFactory();
     
        // Create a new file upload handler
      ServletFileUpload upload = new ServletFileUpload(factory);

        // Parse the request
View Full Code Here

        printError(res, "No Multipart Content transmitted.");
      return ;
      }
     
      // Get the uploaded file
      final FileItemFactory factory = new DiskFileItemFactory();
      final ServletFileUpload servletFileUpload = new ServletFileUpload(factory);
      servletFileUpload.setSizeMax(-1);
      final List<?> items;
      try {
        items = servletFileUpload.parseRequest(req);
View Full Code Here

        }
    }

    protected ServletFileUpload createFileUpload()
    {
        FileItemFactory factory = new DiskFileItemFactory(_repositoryThreshold, new File(
                _repositoryLocation));
        ServletFileUpload upload = new ServletFileUpload(factory);

        // set maximum file upload size
        upload.setSizeMax(_maxRequestSize);
View Full Code Here

    }

    private static List parseRequest(ServletRequestContext requestContext)
            throws FileUploadException {
        // Create a factory for disk-based file items
        FileItemFactory factory = new DiskFileItemFactory();
        // Create a new file upload handler
        ServletFileUpload upload = new ServletFileUpload(factory);
        // Parse the request
        return upload.parseRequest(requestContext);
    }
View Full Code Here

        boolean isMultipart = ServletFileUpload.isMultipartContent(reqContext);
        if (isMultipart) {

            try {
                //Create a factory for disk-based file items
                FileItemFactory factory = new DiskFileItemFactory();
                //Create a new file upload handler
                ServletFileUpload upload = new ServletFileUpload(factory);
                List<?> items = upload.parseRequest(req);
                // Process the uploaded items
                Iterator<?> iter = items.iterator();
View Full Code Here

TOP

Related Classes of org.apache.commons.fileupload.FileItemFactory

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.