Package org.apache.commons.fileupload

Examples of org.apache.commons.fileupload.DiskFileUpload


        response.setContentType("text/html; charset=" + Constants.CHARSET);

        String message = "";

        // Create a new file upload handler
        DiskFileUpload upload = new DiskFileUpload();

        // Get the tempdir
        File tempdir = (File) getServletContext().getAttribute
            ("javax.servlet.context.tempdir");
        // Set upload parameters
        upload.setSizeMax(-1);
        upload.setRepositoryPath(tempdir.getCanonicalPath());
   
        // Parse the request
        String basename = null;
        String war = null;
        FileItem warUpload = null;
        try {
            List items = upload.parseRequest(request);
       
            // Process the uploaded fields
            Iterator iter = items.iterator();
            while (iter.hasNext()) {
                FileItem item = (FileItem) iter.next();
View Full Code Here


      boolean isMultipart = FileUpload.isMultipartContent(req);
      if (isMultipart) {

        try {
          // Create a new file upload handler
          DiskFileUpload upload = new DiskFileUpload();

          List items = upload.parseRequest(req);

          // Process the uploaded items
          Iterator iter = items.iterator();
          while (iter.hasNext()) {
            FileItem item = (FileItem) iter.next();
View Full Code Here

        response.setContentType("text/html; charset=" + Constants.CHARSET);

        String message = "";

        // Create a new file upload handler
        DiskFileUpload upload = new DiskFileUpload();

        // Get the tempdir
        File tempdir = (File) getServletContext().getAttribute
            ("javax.servlet.context.tempdir");
        // Set upload parameters
        upload.setSizeMax(-1);
        upload.setRepositoryPath(tempdir.getCanonicalPath());
   
        // Parse the request
        String basename = null;
        File appBaseDir = null;
        String war = null;
        FileItem warUpload = null;
        try {
            List items = upload.parseRequest(request);
       
            // Process the uploaded fields
            Iterator iter = items.iterator();
            while (iter.hasNext()) {
                FileItem item = (FileItem) iter.next();
View Full Code Here

        this.thresholdSize = thresholdSize;
        this.repositoryPath = repositoryPath;
    }

    private void parseRequest() {
        fileUpload = new DiskFileUpload();
        fileUpload.setFileItemFactory(new DefaultFileItemFactory());
        fileUpload.setSizeMax(maxSize);

        fileUpload.setSizeThreshold(thresholdSize);
View Full Code Here

        response.setContentType("text/html; charset=" + Constants.CHARSET);

        String message = "";

        // Create a new file upload handler
        DiskFileUpload upload = new DiskFileUpload();

        // Get the tempdir
        File tempdir = (File) getServletContext().getAttribute
            ("javax.servlet.context.tempdir");
        // Set upload parameters
        upload.setSizeMax(-1);
        upload.setRepositoryPath(tempdir.getCanonicalPath());
   
        // Parse the request
        String basename = null;
        String war = null;
        FileItem warUpload = null;
        try {
            List items = upload.parseRequest(request);
       
            // Process the uploaded fields
            Iterator iter = items.iterator();
            while (iter.hasNext()) {
                FileItem item = (FileItem) iter.next();
View Full Code Here

        // Get the app config for the current request.
        ModuleConfig ac = (ModuleConfig) request.getAttribute(
                Globals.MODULE_KEY);

        // Create and configure a DIskFileUpload instance.
        DiskFileUpload upload = new DiskFileUpload();
        // Set the maximum size before a FileUploadException will be thrown.
        upload.setSizeMax((int) getSizeMax(ac));
        // Set the maximum size that will be stored in memory.
        upload.setSizeThreshold((int) getSizeThreshold(ac));
        // Set the the location for saving data on disk.
        upload.setRepositoryPath(getRepositoryPath(ac));

        // Create the hash tables to be populated.
        elementsText = new Hashtable();
        elementsFile = new Hashtable();
        elementsAll = new Hashtable();

        // Parse the request into file items.
        List items = null;
        try {
            items = upload.parseRequest(request);
        } catch (DiskFileUpload.SizeLimitExceededException e) {
            // Special handling for uploads that are too big.
            request.setAttribute(
                    MultipartRequestHandler.ATTRIBUTE_MAX_LENGTH_EXCEEDED,
                    Boolean.TRUE);
View Full Code Here

                UploadService.AUTOMATIC_KEY,
                UploadService.AUTOMATIC_DEFAULT);

        log.debug("Auto Upload " + automatic);

        fileUpload = new DiskFileUpload();
        fileUpload.setSizeMax(sizeMax);
        fileUpload.setSizeThreshold(sizeThreshold);
        fileUpload.setRepositoryPath(repoPath);

        setInit(true);
View Full Code Here

                UploadService.AUTOMATIC_KEY,
                UploadService.AUTOMATIC_DEFAULT);

        log.debug("Auto Upload " + automatic);

        fileUpload = new DiskFileUpload();
        fileUpload.setSizeMax(sizeMax);
        fileUpload.setSizeThreshold(sizeThreshold);
        fileUpload.setRepositoryPath(repoPath);

        setInit(true);
View Full Code Here

        response.setContentType("text/html; charset=" + charset);

        String message = "";

        // Create a new file upload handler
        DiskFileUpload upload = new DiskFileUpload();

        // Get the tempdir
        File tempdir = (File) getServletContext().getAttribute
            ("javax.servlet.context.tempdir");
        // Set upload parameters
        upload.setSizeMax(-1);
        upload.setRepositoryPath(tempdir.getCanonicalPath());
   
        // Parse the request
        String war = null;
        FileItem warUpload = null;
        try {
            List items = upload.parseRequest(request);
       
            // Process the uploaded fields
            Iterator iter = items.iterator();
            while (iter.hasNext()) {
                FileItem item = (FileItem) iter.next();
View Full Code Here

  public void handleRequest(HttpServletRequest request) throws ServletException {
    // Get the app config for the current request.
    ModuleConfig ac = (ModuleConfig) request.getAttribute(Globals.MODULE_KEY);

    // Create and configure a DIskFileUpload instance.
    DiskFileUpload upload = new DiskFileUpload();

    // The following line is to support an "EncodingFilter"
    // see http://issues.apache.org/bugzilla/show_bug.cgi?id=23255
    upload.setHeaderEncoding(request.getCharacterEncoding());

    // Set the maximum size before a FileUploadException will be thrown.
    upload.setSizeMax(getSizeMax(ac));

    // Set the maximum size that will be stored in memory.
    upload.setSizeThreshold((int) getSizeThreshold(ac));

    // Set the the location for saving data on disk.
    upload.setRepositoryPath(getRepositoryPath(ac));

    // Create the hash tables to be populated.
    elementsText = new Hashtable();
    elementsFile = new Hashtable();
    elementsAll = new Hashtable();

    // Parse the request into file items.
    List items = null;

    try {
      items = upload.parseRequest(request);
    } catch (DiskFileUpload.SizeLimitExceededException e) {
      // Special handling for uploads that are too big.
      request.setAttribute(MultipartRequestHandler.ATTRIBUTE_MAX_LENGTH_EXCEEDED, Boolean.TRUE);

      return;
View Full Code Here

TOP

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

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.