⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 showuploadaction.java

📁 这是linux下ssl vpn的实现程序
💻 JAVA
字号:
package com.sslexplorer.vfs.actions;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.sslexplorer.core.CoreUtil;
import com.sslexplorer.core.actions.AuthenticatedDispatchAction;
import com.sslexplorer.security.Constants;
import com.sslexplorer.security.SessionInfo;
import com.sslexplorer.vfs.UploadDetails;
import com.sslexplorer.vfs.forms.ShowUploadForm;

/**
 * <p>
 * This is the action which performes the upload of a given file to the location
 * in the {@link com.sslexplorer.vfs.UploadDetails}.
 * 
 * @author James D Robinson
 * 
 * @author James D Robinson <a href="mailto:
 *         james@3sp.com">&lt;james@3sp.com&gt;</a>
 * @version $Revision: 1.9 $
 */
public class ShowUploadAction extends AuthenticatedDispatchAction {

    /*
     * (non-Javadoc)
     * 
     * @see com.sslexplorer.core.actions.CoreAction#getNavigationContext(org.apache.struts.action.ActionMapping,
     *      org.apache.struts.action.ActionForm,
     *      javax.servlet.http.HttpServletRequest,
     *      javax.servlet.http.HttpServletResponse)
     */
    public int getNavigationContext(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {
        return SessionInfo.MANAGEMENT_CONSOLE_CONTEXT | SessionInfo.USER_CONSOLE_CONTEXT;
    }

    /* (non-Javadoc)
     * @see org.apache.struts.actions.DispatchAction#unspecified(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
     */
    public ActionForward unspecified(ActionMapping mapping, ActionForm form, HttpServletRequest request,
                                     HttpServletResponse response) throws Exception {
        return upload(mapping, form, request, response);
    }

    /**
     * Display the upload page.
     * 
     * @param mapping mapping
     * @param form form
     * @param request request
     * @param response response
     * @return forward
     * @throws Exception on any error
     */
    public ActionForward upload(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
                    throws Exception {
        Integer i = (Integer) request.getAttribute(Constants.REQ_ATTR_UPLOAD_DETAILS);
        if (i == null) {
            throw new Exception("No upload id.");
        }
        UploadDetails upload = CoreUtil.getUpload(request.getSession(), i.intValue());
        if (upload == null) {
            throw new Exception("No file upload details configured for upload id " + i + ".");
        }
        ((ShowUploadForm) form).initialise(i.intValue(), upload);
        CoreUtil.addRequiredFieldMessage(this, request);
        return mapping.findForward("display");
    }

    /**
     * Uploading is complete. Clean up.
     * 
     * @param mapping mapping
     * @param form form
     * @param request request
     * @param response response
     * @return forward
     * @throws Exception on any error
     */
    public ActionForward uploadDone(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
                    throws Exception {
        UploadDetails upload = CoreUtil.removeUpload(request.getSession(), ((ShowUploadForm) form).getUploadId());
        return upload.getDoneForward();
    }

    /**
     * Uploading is complete. Clean up.
     * 
     * @param mapping mapping
     * @param form form
     * @param request request
     * @param response response
     * @return forward
     * @throws Exception on any error
     */
    public ActionForward cancel(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
                    throws Exception {
        UploadDetails upload = CoreUtil.removeUpload(request.getSession(), ((ShowUploadForm) form).getUploadId());
        return upload.getCancelForward();
    }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -