KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > struts > action > ActionServletWrapper


1 /*
2  * $Id: ActionServletWrapper.java 55459 2004-10-24 19:23:54Z martinc $
3  *
4  * Copyright 2000-2004 The Apache Software Foundation.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * 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
19
20 package org.apache.struts.action;
21
22 import java.io.Serializable JavaDoc;
23 import org.apache.struts.upload.MultipartRequestHandler;
24
25
26 /**
27  * <p>Provide a wrapper around an {@link ActionServlet} to expose only
28  * those methods needed by other objects. When used with an
29  * {@link ActionForm}, subclasses must be careful that they do
30  * not return an object with public getters and setters that
31  * could be exploited by automatic population of properties.</p>
32  *
33  * @version $Rev: 55459 $ $Date: 2004-10-24 20:23:54 +0100 (Sun, 24 Oct 2004) $
34  * @since Struts 1.0.1
35  */

36 public class ActionServletWrapper implements Serializable JavaDoc {
37
38     /**
39      * <p>The servlet instance to which we are attached.</p>
40      */

41     protected transient ActionServlet servlet = null;
42
43     /**
44      * <p>Set servlet to a <code>MultipartRequestHandler</code>.</p>
45      *
46      * @param object The MultipartRequestHandler
47      */

48      public void setServletFor(MultipartRequestHandler object) {
49
50         object.setServlet(this.servlet);
51         // :FIXME: Should this be based on an "setServlet"
52
// interface or introspection for a setServlet method?
53
// Or, is it safer to just add the types we want as we want them?
54

55     }
56
57
58     /**
59      * <p>Create object and set <code>servlet</code> property.</p>
60      *
61      * @param servlet <code>ActionServlet</code> to wrap
62      */

63      public ActionServletWrapper(ActionServlet servlet) {
64
65         super();
66         this.servlet = servlet;
67
68     }
69
70 }
71
Popular Tags