1 17 package org.apache.geronimo.console.keystores; 18 19 import java.io.IOException ; 20 21 import javax.portlet.ActionRequest; 22 import javax.portlet.ActionResponse; 23 import javax.portlet.PortletException; 24 import javax.portlet.RenderRequest; 25 import javax.portlet.RenderResponse; 26 27 import org.apache.geronimo.console.MultiPageModel; 28 import org.apache.geronimo.management.geronimo.KeystoreException; 29 30 35 public class ImportCAReplyHandler extends BaseKeystoreHandler { 36 public ImportCAReplyHandler() { 37 super(IMPORT_CA_REPLY, "/WEB-INF/view/keystore/importCAReply.jsp"); 38 } 39 40 public String actionBeforeView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException { 41 String id = request.getParameter("id"); 42 String alias = request.getParameter("alias"); 43 response.setRenderParameter("id", id); 44 response.setRenderParameter("alias", alias); 45 return getMode(); 46 } 47 public void renderView(RenderRequest request, RenderResponse response, MultiPageModel model) throws PortletException, IOException { 48 String id = request.getParameter("id"); 49 String alias = request.getParameter("alias"); 50 request.setAttribute("id", id); 51 request.setAttribute("alias", alias); 52 } 53 54 public String actionAfterView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException { 55 String id = request.getParameter("id"); 56 String alias = request.getParameter("alias"); 57 response.setRenderParameter("id", id); 58 response.setRenderParameter("alias", alias); 59 if("Cancel".equals(request.getParameter("submit"))) 60 return CERTIFICATE_DETAILS+BEFORE_ACTION; 61 String pkcs7cert = request.getParameter("pkcs7cert"); 62 KeystoreData data = ((KeystoreData) request.getPortletSession(true).getAttribute(KEYSTORE_DATA_PREFIX + id)); 63 try { 64 data.importPKCS7Certificate(alias, pkcs7cert); 65 } catch (KeystoreException e) { 66 throw new PortletException(e); 67 } 68 return CERTIFICATE_DETAILS+BEFORE_ACTION; 69 } 70 } 71 | Popular Tags |