e.g. Calendar Search Help
You must enter a value before pressing Search
tomcat

Class: org.apache.catalina.authenticator.SavedRequest   ©

 OK to copy?
001 /*
002  * Copyright 1999,2004 The Apache Software Foundation.
003  * 
004  * Licensed under the Apache License, Version 2.0 (the "License");
005  * you may not use this file except in compliance with the License.
006  * You may obtain a copy of the License at
007  * 
008  *      http://www.apache.org/licenses/LICENSE-2.0
009  * 
010  * Unless required by applicable law or agreed to in writing, software
011  * distributed under the License is distributed on an "AS IS" BASIS,
012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013  * See the License for the specific language governing permissions and
014  * limitations under the License.
015  */
016 
017 
018 package org.apache.catalina.authenticator;
019 
020 
021 import java.util.ArrayList;
022 import java.util.HashMap;
023 import java.util.Iterator;
024 import java.util.Locale;
025 
026 import javax.servlet.http.Cookie;
027 
028 
029 /**
030  * Object that saves the critical information from a request so that
031  * form-based authentication can reproduce it once the user has been
032  * authenticated.
033  * <p>
034  * <b>IMPLEMENTATION NOTE</b> - It is assumed that this object is accessed
035  * only from the context of a single thread, so no synchronization around
036  * internal collection classes is performed.
037  * <p>
038  * <b>FIXME</b> - Currently, this object has no mechanism to save or
039  * restore the data content of the request, although it does save
040  * request parameters so that a POST transaction can be faithfully
041  * duplicated.
042  *
043  * @author Craig R. McClanahan
044  * @version $Revision: 1.3 $ $Date: 2004/02/27 14:58:41 $
045  */
046 
047 public final class SavedRequest {
048 
049 
050     /**
051      * The set of Cookies associated with this Request.
052      */
053     private ArrayList cookies = new ArrayList();
054 
055     public void addCookie(Cookie cookie) {
056         cookies.add(cookie);
057     }
058 
059     public Iterator getCookies() {
060         return (cookies.iterator());
061     }
062 
063 
064     /**
065      * The set of Headers associated with this Request.  Each key is a header
066      * name, while the value is a ArrayList containing one or more actual
067      * values for this header.  The values are returned as an Iterator when
068      * you ask for them.
069      */
070     private HashMap headers = new HashMap();
071 
072     public void addHeader(String name, String value) {
073         ArrayList values = (ArrayList) headers.get(name);
074         if (values == null) {
075             values = new ArrayList();
076             headers.put(name, values);
077         }
078         values.add(value);
079     }
080 
081     public Iterator getHeaderNames() {
Rate082         return (headers.keySet().iterator());
083     }
084 
085     public Iterator getHeaderValues(String name) {
086         ArrayList values = (ArrayList) headers.get(name);
087         if (values == null)
088             return ((new ArrayList()).iterator());
089         else
090             return (values.iterator());
091     }
092 
093 
094     /**
095      * The set of Locales associated with this Request.
096      */
097     private ArrayList locales = new ArrayList();
098 
099     public void addLocale(Locale locale) {
100         locales.add(locale);
101     }
102 
103     public Iterator getLocales() {
104         return (locales.iterator());
105     }
106 
107 
108     /**
109      * The request method used on this Request.
110      */
111     private String method = null;
112 
113     public String getMethod() {
114         return (this.method);
115     }
116 
117     public void setMethod(String method) {
118         this.method = method;
119     }
120 
121 
122 
123     /**
124      * The set of request parameters associated with this Request.  Each
125      * entry is keyed by the parameter name, pointing at a String array of
126      * the corresponding values.
127      */
128     private HashMap parameters = new HashMap();
129 
130     public void addParameter(String name, String values[]) {
131         parameters.put(name, values);
132     }
133 
134     public Iterator getParameterNames() {
Rate135         return (parameters.keySet().iterator());
136     }
137 
138     public String[] getParameterValues(String name) {
139         return ((String[]) parameters.get(name));
140     }
141 
142 
143     /**
144      * The query string associated with this Request.
145      */
146     private String queryString = null;
147 
148     public String getQueryString() {
149         return (this.queryString);
150     }
151 
152     public void setQueryString(String queryString) {
153         this.queryString = queryString;
154     }
155 
156 
157     /**
158      * The request URI associated with this Request.
159      */
160     private String requestURI = null;
161 
162     public String getRequestURI() {
163         return (this.requestURI);
164     }
165 
166     public void setRequestURI(String requestURI) {
167         this.requestURI = requestURI;
168     }
169 
170 
171 }

            
All Examples in File:
Example
Line
Rating (found
useful by...)
82 0% of 0
135 0% of 0