KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > tools > guiframework > event > handlers > RequestParameterHandlers


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 package com.sun.enterprise.tools.guiframework.event.handlers;
25
26 import com.iplanet.jato.RequestContext;
27
28 import com.sun.enterprise.tools.guiframework.view.HandlerContext;
29
30 import java.util.Map JavaDoc;
31
32
33 /**
34  *
35  */

36 public class RequestParameterHandlers {
37
38     /**
39      * <p> This method retrieves the request parameter by the given key. If
40      * the request parameter does not exist, null will be returned. It
41      * requires a parameter named KEY be passed in via the parameter
42      * Map.</p>
43      *
44      * @param reqCtx The RequestContext
45      * @param handlerCtx The HandlerContext
46      *
47      *
48      */

49     public void getRequestParameter(RequestContext reqCtx, HandlerContext handlerCtx) {
50         Object JavaDoc key = handlerCtx.getInputValue(KEY);
51     if (key == null) {
52         throw new IllegalArgumentException JavaDoc(
53         "The parameter map did not contain a key!");
54     }
55     handlerCtx.setOutputValue(
56         VALUE, reqCtx.getRequest().getParameter(key.toString()));
57     }
58
59
60     /**
61      * <p> This method retrieves the request parameter by the given key. If
62      * the request parameter does not exist, null will be returned. It
63      * requires a parameter named KEY to be passed in via the
64      * parameter Map.</p>
65      *
66      * @param reqCtx The RequestContext
67      * @param handlerCtx The HandlerContext
68      */

69     public void getRequestParameters(RequestContext reqCtx, HandlerContext handlerCtx) {
70         Object JavaDoc key = handlerCtx.getInputValue(KEY);
71     if (key == null) {
72         throw new IllegalArgumentException JavaDoc(
73         "The parameter map did not contain a key!");
74     }
75     handlerCtx.setOutputValue(
76         VALUE, reqCtx.getRequest().getParameterValues(key.toString()));
77     }
78
79
80     /**
81      *
82      */

83     public static final String JavaDoc VALUE = "value";
84
85     /**
86      *
87      */

88     public static final String JavaDoc KEY = "key";
89 }
90
Popular Tags