KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sslexplorer > vfs > actions > ConfirmUploadAction


1 package com.sslexplorer.vfs.actions;
2
3 import javax.servlet.http.HttpServletRequest JavaDoc;
4 import javax.servlet.http.HttpServletResponse JavaDoc;
5
6 import org.apache.commons.logging.Log;
7 import org.apache.commons.logging.LogFactory;
8 import org.apache.struts.action.ActionForm;
9 import org.apache.struts.action.ActionForward;
10 import org.apache.struts.action.ActionMapping;
11
12 import com.sslexplorer.core.CoreUtil;
13 import com.sslexplorer.core.actions.AbstractPopupAuthenticatedDispatchAction;
14 import com.sslexplorer.security.Constants;
15 import com.sslexplorer.security.SessionInfo;
16 import com.sslexplorer.vfs.UploadDetails;
17 import com.sslexplorer.vfs.forms.UploadForm;
18
19 public class ConfirmUploadAction extends AbstractPopupAuthenticatedDispatchAction {
20
21     static Log log = LogFactory.getLog(UploadAction.class);
22         
23     public ActionForward unspecified(ActionMapping mapping, ActionForm form, HttpServletRequest JavaDoc request, HttpServletResponse JavaDoc response) throws Exception JavaDoc {
24         try {
25             if (log.isDebugEnabled())
26                 log.debug("Execute file upload.");
27             
28             String JavaDoc confirm = request.getParameter("confirm");
29             ActionForm uploadForm = (UploadForm)request.getSession().getAttribute("uploadForm");
30             form = (UploadForm)uploadForm;
31             int uploadId = ((UploadForm)uploadForm).getUploadId();
32             UploadDetails upload = CoreUtil.getUpload(request.getSession(), uploadId);
33             request.setAttribute(Constants.REQ_ATTR_UPLOAD_DETAILS, uploadId);
34             UploadAction action = new UploadAction();
35             request.getSession().removeAttribute("uploadForm");
36             if("yes".equals(confirm)) {
37                 return action.confirmUpload(mapping, uploadForm, request, response);
38             } else {
39                 return new ActionForward(upload.getUploadedForward().getPath());
40             }
41         } catch (Exception JavaDoc e) {
42             log.error("Confirm Upload error: " + e);
43             throw e;
44         }
45     }
46
47     public int getNavigationContext(ActionMapping mapping, ActionForm form, HttpServletRequest JavaDoc request, HttpServletResponse JavaDoc response) {
48         return SessionInfo.MANAGEMENT_CONSOLE_CONTEXT | SessionInfo.USER_CONSOLE_CONTEXT;
49     }
50
51 }
52
Popular Tags