1 19 20 package com.sslexplorer.security.actions; 21 22 import javax.servlet.http.HttpServletRequest ; 23 import javax.servlet.http.HttpServletResponse ; 24 25 import org.apache.commons.logging.Log; 26 import org.apache.commons.logging.LogFactory; 27 import org.apache.struts.action.ActionForm; 28 import org.apache.struts.action.ActionForward; 29 import org.apache.struts.action.ActionMapping; 30 31 import com.sslexplorer.core.actions.AuthenticatedDispatchAction; 32 import com.sslexplorer.policyframework.Permission; 33 import com.sslexplorer.policyframework.PolicyConstants; 34 import com.sslexplorer.security.SessionInfo; 35 import com.sslexplorer.security.forms.IpRestrictionInformationForm; 36 37 public class IpRestrictionInformationAction extends AuthenticatedDispatchAction { 38 39 final static Log log = LogFactory.getLog(IpRestrictionInformationAction.class); 40 41 44 public IpRestrictionInformationAction() { 45 super(PolicyConstants.IP_RESTRICTIONS_RESOURCE_TYPE, new Permission[] { PolicyConstants.PERM_CREATE, PolicyConstants.PERM_DELETE }); 46 } 47 48 56 public ActionForward unspecified(ActionMapping mapping, ActionForm form, HttpServletRequest request, 57 HttpServletResponse response) throws Exception { 58 try { 59 String allowed = request.getParameter("allowed"); 60 String ip = request.getParameter("ip"); 61 ((IpRestrictionInformationForm) form).initialise(allowed, ip);; 62 return mapping.findForward("display"); 63 } catch (Exception e) { 64 log.error("Failed to get extension information. ", e); 65 response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage()); 66 return null; 67 } 68 } 69 70 78 public int getNavigationContext(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { 79 return SessionInfo.MANAGEMENT_CONSOLE_CONTEXT; 80 } 81 } 82 | Popular Tags |