KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > geronimo > console > ca > ConfirmCertReqHandler


1 /**
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one or more
4  * contributor license agreements. See the NOTICE file distributed with
5  * this work for additional information regarding copyright ownership.
6  * The ASF licenses this file to You under the Apache License, Version 2.0
7  * (the "License"); you may not use this file except in compliance with
8  * the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */

18 package org.apache.geronimo.console.ca;
19
20 import java.io.IOException JavaDoc;
21
22 import javax.portlet.ActionRequest;
23 import javax.portlet.ActionResponse;
24 import javax.portlet.PortletException;
25 import javax.portlet.RenderRequest;
26 import javax.portlet.RenderResponse;
27
28 import org.apache.geronimo.console.MultiPageModel;
29
30 /**
31  * Handler for the Confirm Certificate Request screen.
32  *
33  * @version $Rev: 476291 $ $Date: 2006-11-17 15:05:24 -0500 (Fri, 17 Nov 2006) $
34  */

35 public class ConfirmCertReqHandler extends BaseCAHandler {
36     public ConfirmCertReqHandler() {
37         super(CONFIRM_CERT_REQ_MODE, "/WEB-INF/view/ca/confirmCertReq.jsp");
38     }
39
40     public String JavaDoc actionBeforeView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException JavaDoc {
41         String JavaDoc[] params = {ERROR_MSG, INFO_MSG, "subject", "publickey", "requestId"};
42         for(int i = 0; i < params.length; ++i) {
43             String JavaDoc value = request.getParameter(params[i]);
44             if(value != null) response.setRenderParameter(params[i], value);
45         }
46         return getMode();
47     }
48
49     public void renderView(RenderRequest request, RenderResponse response, MultiPageModel model) throws PortletException, IOException JavaDoc {
50         String JavaDoc[] params = {ERROR_MSG, INFO_MSG, "subject", "publickey", "requestId"};
51         for(int i = 0; i < params.length; ++i) {
52             String JavaDoc value = request.getParameter(params[i]);
53             if(value != null) request.setAttribute(params[i], value);
54         }
55     }
56
57     public String JavaDoc actionAfterView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException JavaDoc {
58         String JavaDoc requestId = request.getParameter("requestId");
59         String JavaDoc approve = request.getParameter("approve");
60         String JavaDoc reject = request.getParameter("reject");
61         if(approve != null) {
62             getCertificateRequestStore(request).setRequestVerified(requestId);
63             response.setRenderParameter(INFO_MSG, "Approved CSR. id = "+requestId);
64         } else if(reject != null) {
65             getCertificateRequestStore(request).deleteRequest(requestId);
66             response.setRenderParameter(INFO_MSG, "Rejected and deleted CSR. id = "+requestId);
67         }
68         return LIST_REQUESTS_VERIFY_MODE+BEFORE_ACTION;
69     }
70 }
71
Popular Tags