KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > catalina > core > StandardValveContext


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

27
28
29 package org.apache.catalina.core;
30
31
32 import java.io.IOException JavaDoc;
33 import javax.servlet.ServletException JavaDoc;
34 import org.apache.catalina.Request;
35 import org.apache.catalina.Response;
36 import org.apache.catalina.Valve;
37 import org.apache.catalina.ValveContext;
38 import org.apache.catalina.util.StringManager;
39
40
41 /**
42  * Standard implementation of a <code>ValveContext</code>.
43  *
44  * @author Craig R. McClanahan
45  * @author Remy Maucherat
46  *
47  * <IMPLEMENTATION-NOTE>
48 ???* This class is no longer used in PE 8.0. See bug 4665318
49  * @author Jean-Francois Arcand
50  * </IMPLEMENTATION-NOTE>
51  */

52
53 public final class StandardValveContext
54     implements ValveContext {
55
56
57     // ----------------------------------------------------- Instance Variables
58

59
60     /**
61      * The string manager for this package.
62      */

63     protected static final StringManager sm =
64         StringManager.getManager(Constants.Package);
65
66
67     protected String JavaDoc info =
68         "org.apache.catalina.core.StandardValveContext/1.0";
69     protected int stage = 0;
70     protected Valve basic = null;
71     protected Valve valves[] = null;
72
73
74     // ------------------------------------------------------------- Properties
75

76
77     /**
78      * Return descriptive information about this ValveContext
79      * implementation.
80      */

81     public String JavaDoc getInfo() {
82         return info;
83     }
84
85
86     // --------------------------------------------------------- Public Methods
87

88
89     /**
90      * Cause the <code>invoke()</code> method of the next Valve that is
91      * part of the Pipeline currently being processed (if any) to be
92      * executed, passing on the specified request and response objects
93      * plus this <code>ValveContext</code> instance. Exceptions thrown by
94      * a subsequently executed Valve (or a Filter or Servlet at the
95      * application level) will be passed on to our caller.
96      *
97      * If there are no more Valves to be executed, an appropriate
98      * ServletException will be thrown by this ValveContext.
99      *
100      * @param request The request currently being processed
101      * @param response The response currently being created
102      *
103      * @exception IOException if thrown by a subsequent Valve, Filter, or
104      * Servlet
105      * @exception ServletException if thrown by a subsequent Valve, Filter,
106      * or Servlet
107      * @exception ServletException if there are no further Valves
108      * configured in the Pipeline currently being processed
109      */

110     public final void invokeNext(Request request, Response response)
111         throws IOException JavaDoc, ServletException JavaDoc {
112
113         /** STARTS OF PE 4665318
114         int subscript = stage;
115         stage = stage + 1;
116
117         // Invoke the requested Valve for the current request thread
118         if (subscript < valves.length) {
119             valves[subscript].invoke(request, response, this);
120         } else if ((subscript == valves.length) && (basic != null)) {
121             basic.invoke(request, response, this);
122         } else {
123             throw new ServletException
124                 (sm.getString("standardPipeline.noValve"));
125         }
126         */

127         // END OF PE 4665318
128
}
129
130
131     // -------------------------------------------------------- Package Methods
132

133
134     /**
135      * Reset state.
136      */

137     void set(Valve basic, Valve valves[]) {
138         stage = 0;
139         this.basic = basic;
140         this.valves = valves;
141     }
142
143
144 }
145
146
Popular Tags