Package com.adito.vfs.forms

Examples of com.adito.vfs.forms.UploadForm


     */
    public ActionForward onExecute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
                    throws Exception {
      if (log.isDebugEnabled())
        log.debug("Execute file upload.");
        UploadForm uploadForm = (UploadForm) form;
        int uploadId = uploadForm.getUploadId();
        UploadDetails upload = CoreUtil.getUpload(request.getSession(), uploadId);
        if (upload == null) {
            throw new Exception("No file upload details configured for upload id " + uploadId + ".");
        }
        int sessionTimeoutBlockId = LogonControllerFactory.getInstance().addSessionTimeoutBlock(request.getSession(),
            "Upload request.");
        try {
            UploadHandler handler = UploadHandlerFactory.getInstance().getUploader(upload.getType());
            if (handler == null) {
                throw new Exception("No handler for upload type " + upload.getType());
            }
            request.setAttribute(Constants.REQ_ATTR_UPLOAD_DETAILS, new Integer(uploadId));
           
            boolean isFileExist = handler.checkFileToUpload(request, response, upload, uploadForm.getUploadFile());
            if (isFileExist) {
                request.getSession().setAttribute("uploadForm", uploadForm);
                return new ActionForward("/confirmFileUpload.do?arg0=" + uploadForm.getUploadFile().getFileName());
            } else {
                return confirmUpload(mapping, form, request, response);
            }

        } catch (Exception e) {
View Full Code Here


    }
   
    public ActionForward confirmUpload(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
        if (log.isDebugEnabled())
            log.debug("Execute file upload.");
        UploadForm uploadForm = (UploadForm) form;
        int uploadId = uploadForm.getUploadId();
        UploadDetails upload = CoreUtil.getUpload(request.getSession(), uploadId);
        if (upload == null) {
            throw new Exception("No file upload details configured for upload id " + uploadId + ".");
        }
        int sessionTimeoutBlockId = LogonControllerFactory.getInstance().addSessionTimeoutBlock(request.getSession(),
            "Upload request.");
       
        try {
            UploadHandler handler = UploadHandlerFactory.getInstance().getUploader(upload.getType());
            if (handler == null) {
                throw new Exception("No handler for upload type " + upload.getType());
            }
            request.setAttribute(Constants.REQ_ATTR_UPLOAD_DETAILS, new Integer(uploadId));

            ActionForward fwd = handler.performUpload(request, response, upload, uploadForm.getUploadFile());
            ActionMessages msgs = new ActionMessages();
            if(upload.getResourcePath()==null) {
                msgs.add(Globals.MESSAGE_KEY, new BundleActionMessage("vfs", "upload.info.fileUploadedNoPath", uploadForm.getUploadFile()
                        .getFileName()));
            } else {
                msgs.add(Globals.MESSAGE_KEY, new BundleActionMessage("vfs", "upload.info.fileUploaded", uploadForm.getUploadFile()
                            .getFileName(), upload.getResourcePath()));
            }
            saveMessages(request, msgs);
            request.setAttribute(Constants.REQ_ATTR_UPLOAD_DETAILS, uploadId);
            uploadForm.setUploadId(uploadId);
            return fwd;
        }
        catch (CoreException ce) {
            log.error("Failed to upload.", ce);
            ActionMessages errs = getErrors(request);
View Full Code Here

     * @see com.adito.core.actions.AuthenticatedAction#onExecute(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
     */
    public ActionForward onExecute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
                    throws Exception {
        String alias = request.getParameter("alias");
        UploadForm uploadForm = (UploadForm) form;
        FormFile uploadFile = uploadForm.getUploadFile();
        String fileName = uploadFile.getFileName();

        if (fileName.trim().length() == 0) {
            saveError(request, "installation.uploadExistingCertificate.noFileProvided");
            return mapping.getInputForward();
View Full Code Here

     */
    public ActionForward onExecute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
                    throws Exception {
        String passphrase = request.getParameter("passphrase");
        String alias = request.getParameter("alias");
        UploadForm uploadForm = (UploadForm) form;
        FormFile uploadFile = uploadForm.getUploadFile();
        String fileName = uploadFile.getFileName();
        int fileSize = uploadFile.getFileSize();
        InputStream in = null;
        OutputStream out = null;
        File uploadedFile = File.createTempFile("uploadedFile", "");
View Full Code Here

TOP

Related Classes of com.adito.vfs.forms.UploadForm

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.