Package org.apache.commons.fileupload.disk

Examples of org.apache.commons.fileupload.disk.DiskFileItemFactory


            // Forward the request headers
            setProxyRequestHeaders(request, putMethodProxyRequest);
            // Check if this is a multipart (file upload) POST
            if (ServletFileUpload.isMultipartContent(request)) {
                logger.info("PUT:: Multipart");
                DiskFileItemFactory diskFactory = createDiskFactory();
                HttpUtilities.handleMultipartPost(putMethodProxyRequest, request, diskFactory);
            } else {
                logger.info("PUT:: Not Multipart");
                HttpUtilities.handleStandardPost(putMethodProxyRequest, request, history);
            }
View Full Code Here


            if (!rootDir.exists()) {
                rootDir.mkdirs();
            }

            PortletFileUpload uploader = new PortletFileUpload(
                    new DiskFileItemFactory(10240, rootDir));

            File uploadFile = null;

            try {
View Full Code Here

            throw new PortletException("Expected file upload");
        }

        File rootDir = new File(System.getProperty("java.io.tmpdir"));
        PortletFileUpload uploader = new PortletFileUpload(
                new DiskFileItemFactory(10240, rootDir));
        File moduleFile = null;
        File planFile = null;
        String startApp = null;
        try {
            List items = uploader.parseRequest(actionRequest);
View Full Code Here

        response.setCharacterEncoding("utf-8");
        request.setCharacterEncoding("utf-8");
        PrintWriter out = response.getWriter();
       try {
           // Create a factory for disk-based file items
           DiskFileItemFactory factory = new DiskFileItemFactory();
           // Set factory constraints
           factory.setSizeThreshold(4096); // 设置缓冲区大小,这里是4kb
           //factory.setRepository(tempPathFile);// 设置缓冲区目录
           // Create a new file upload handler
           ServletFileUpload upload = new ServletFileUpload(factory);
View Full Code Here

        response.setCharacterEncoding("utf-8");
        request.setCharacterEncoding("utf-8");
        PrintWriter out = response.getWriter();
       try {
           // Create a factory for disk-based file items
           DiskFileItemFactory factory = new DiskFileItemFactory();
           // Set factory constraints
           factory.setSizeThreshold(4096); // 设置缓冲区大小,这里是4kb
           //factory.setRepository(tempPathFile);// 设置缓冲区目录
           // Create a new file upload handler
           ServletFileUpload upload = new ServletFileUpload(factory);
View Full Code Here

    /**
     * Get the form data from the inbound request.
     */
    @SuppressWarnings("rawtypes")
    public static FormData getFormData(HttpServletRequest request) {
        FileItemFactory factory = new DiskFileItemFactory();
        ServletFileUpload upload = new ServletFileUpload( factory );
        upload.setHeaderEncoding( "UTF-8" );

        FormData data = new FormData();
        try {
View Full Code Here

    public RequestMultipartWrapper(HttpServletRequest request, String saveDirectory, int maxPostSize, String encoding) throws IOException {
        super(request);
        this.privateDir = saveDirectory;
        this.encoding = encoding;

        DiskFileItemFactory factory = new DiskFileItemFactory();

        // factory.setSizeThreshold(yourMaxMemorySize);

        if (privateDir != null) {
            File dir = new File(privateDir);
            if (dir.isDirectory() && dir.canWrite()) {
                factory.setRepository(dir);
            } else {
                log.warn("Directory " + privateDir + " is not valid or permissions to write not granted");
            }
        }
View Full Code Here

        HttpSession session = request.getSession(true);
        GenericValue userLogin = (GenericValue) session.getAttribute("userLogin");
        LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher");
       
        Map<String, String> formInput = FastMap.newInstance();
        ServletFileUpload fu = new ServletFileUpload(new DiskFileItemFactory(10240, FileUtil.getFile("runtime/tmp")));
        List<FileItem> lst = null;
        try {
           lst = UtilGenerics.checkList(fu.parseRequest(request));
        } catch (FileUploadException e4) {
            return e4.getMessage();
View Full Code Here

    final String DEPLOY_FOLDER = getServletContext().getRealPath(properties.getString("widget.deployfolder"));//$NON-NLS-1$

    //
    // Create factory for processing POSTed files
    //
    FileItemFactory factory = new DiskFileItemFactory();

    //
    // Create a new file upload handler
    //
    ServletFileUpload upload = new ServletFileUpload(factory);
View Full Code Here

    // TODO: This method is not used and should be removed. amb
    public static String uploadAndStoreImage(HttpServletRequest request, String idField, String uploadField) {
        //Delegator delegator = (Delegator) request.getAttribute("delegator");

        //String idFieldValue = null;
        ServletFileUpload fu = new ServletFileUpload(new DiskFileItemFactory(10240, FileUtil.getFile("runtime/tmp")));
        List<FileItem> lst = null;
        Locale locale = UtilHttp.getLocale(request);

        try {
            lst = UtilGenerics.checkList(fu.parseRequest(request));
View Full Code Here

TOP

Related Classes of org.apache.commons.fileupload.disk.DiskFileItemFactory

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.