Package org.netbeans.lib.uihandler

Examples of org.netbeans.lib.uihandler.MultiPartHandler


        File appFile = null;
        String contentType = request.getContentType();
        if (contentType != null && contentType.toLowerCase().startsWith("multipart/form-data")) {

            RequestFacadeImpl facade = new RequestFacadeImpl(request);
            MultiPartHandler multiReq = new MultiPartHandler(facade, usagesDirPath, Utils.getMaxUploadSize());
            try{
                multiReq.parseMultipartUpload();
                // the file is uploaded as arguments "logs"
                appFile = multiReq.getFile("logs"); // NOI18N
            }catch(SocketTimeoutException ste){
                LOG.severe(ste.getMessage());
                response.sendError(HttpServletResponse.SC_REQUEST_TIMEOUT);
                return;
            }finally{
View Full Code Here


        if (contentType == null || !contentType.toLowerCase().startsWith("multipart/form-data")) {
            return null;
        }

        RequestFacadeImpl facade = new RequestFacadeImpl(request);
        MultiPartHandler multiReq = new MultiPartHandler(facade, tmpDir.getAbsolutePath(), Utils.getMaxUploadSize());
        try{
            multiReq.parseMultipartUpload();
        }finally{
            facade.getInput().getInputStream().close();
        }

        // the file is uploaded as arguments "logs"
        File appFile = multiReq.getFile("logs"); // NOI18N
        if (appFile == null) {
            return null;
        }
        File result =  move(appFile, Utils.getRootUploadDirPath());

        File messagesFile = multiReq.getFile("messages");
        if (messagesFile != null){
            String messagesRootUploadDir = Utils.getMessagesRootUploadDir();
            String messagesUploadDir = Utils.getUploadDirPath(messagesRootUploadDir, getId(appFile));
            File targetFile = new File(messagesUploadDir, result.getName());
            if (!messagesFile.renameTo(targetFile)) {
                LOG.severe("moving " + messagesFile.getPath() + " to " + targetFile.getPath() + " failed");
            } else {
                LOG.fine("moving " + messagesFile.getPath() + " to " + targetFile.getPath()  + " done");
            }
        }
        moveAdditional(multiReq.getFile("slowness"), appFile, result.getName(), Utils.getSlownessRootUploadDir());
        moveAdditional(multiReq.getFile("heapdump"), appFile, result.getName(), Utils.getHeapRootUploadDir());
       
        return result;
    }
View Full Code Here

TOP

Related Classes of org.netbeans.lib.uihandler.MultiPartHandler

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.