1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.catalina.core;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.net.Socket;
import java.security.Principal;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
import javax.servlet.FilterChain;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletInputStream;
import javax.servlet.ServletRequest;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.apache.catalina.Context;
import org.apache.catalina.Host;
import org.apache.catalina.Wrapper;
import org.apache.catalina.connector.Connector;
import org.apache.catalina.connector.Response;
import org.apache.tomcat.util.buf.MessageBytes;
/**
* Dummy request object, used for request dispatcher mapping, as well as
* JSP precompilation.
*
* @author Remy Maucherat
*
*/
public class DummyRequest
implements HttpServletRequest {
public DummyRequest() {
}
public DummyRequest(String contextPath, String decodedURI,
String queryString) {
this.contextPath = contextPath;
this.decodedURI = decodedURI;
this.queryString = queryString;
}
protected String contextPath = null;
protected String decodedURI = null;
protected String queryString = null;
protected String pathInfo = null;
protected String servletPath = null;
protected Wrapper wrapper = null;
protected FilterChain filterChain = null;
private static Enumeration dummyEnum = new Enumeration(){
public boolean hasMoreElements(){
return false;
}
public Object nextElement(){
return null;
}
};
public String getContextPath() {
return (contextPath);
}
public MessageBytes getContextPathMB() {
return null;
}
public ServletRequest getRequest() {
return (this);
}
public String getDecodedRequestURI() {
return decodedURI;
}
public MessageBytes getDecodedRequestURIMB() {
return null;
}
public FilterChain getFilterChain() {
return (this.filterChain);
}
public void setFilterChain(FilterChain filterChain) {
this.filterChain = filterChain;
}
public String getQueryString() {
return queryString;
}
public void setQueryString(String query) {
queryString = query;
}
public String getPathInfo() {
return pathInfo;
}
public void setPathInfo(String path) {
pathInfo = path;
}
public MessageBytes getPathInfoMB() {
return null;
}
public MessageBytes getRequestPathMB() {
return null;
}
public String getServletPath() {
return servletPath;
}
public void setServletPath(String path) {
servletPath = path;
}
public MessageBytes getServletPathMB() {
return null;
}
public Wrapper getWrapper() {
return (this.wrapper);
}
public void setWrapper(Wrapper wrapper) {
this.wrapper = wrapper;
}
public String getAuthorization() { return null; }
public void setAuthorization(String authorization) {}
public Connector getConnector() { return null; }
public void setConnector(Connector connector) {}
public Context getContext() { return null; }
public void setContext(Context context) {}
public Host getHost() { return null; }
public void setHost(Host host) {}
public String getInfo() { return null; }
public Response getResponse() { return null; }
public void setResponse(Response response) {}
public Socket getSocket() { return null; }
public void setSocket(Socket socket) {}
public InputStream getStream() { return null; }
public void setStream(InputStream input) {}
public void addLocale(Locale locale) {}
public ServletInputStream createInputStream() throws IOException {
return null;
}
public void finishRequest() throws IOException {}
public Object getNote(String name) { return null; }
public Iterator getNoteNames() { return null; }
public void removeNote(String name) {}
public void setContentType(String type) {}
public void setNote(String name, Object value) {}
public void setProtocol(String protocol) {}
public void setRemoteAddr(String remoteAddr) {}
public void setRemoteHost(String remoteHost) {}
public void setScheme(String scheme) {}
public void setServerName(String name) {}
public void setServerPort(int port) {}
public Object getAttribute(String name) { return null; }
public Enumeration getAttributeNames() { return null; }
public String getCharacterEncoding() { return null; }
public int getContentLength() { return -1; }
public void setContentLength(int length) {}
public String getContentType() { return null; }
public ServletInputStream getInputStream() throws IOException {
return null;
}
public Locale getLocale() { return null; }
public Enumeration getLocales() { return null; }
public String getProtocol() { return null; }
public BufferedReader getReader() throws IOException { return null; }
public String getRealPath(String path) { return null; }
public String getRemoteAddr() { return null; }
public String getRemoteHost() { return null; }
public String getScheme() { return null; }
public String getServerName() { return null; }
public int getServerPort() { return -1; }
public boolean isSecure() { return false; }
public void removeAttribute(String name) {}
public void setAttribute(String name, Object value) {}
public void setCharacterEncoding(String enc)
throws UnsupportedEncodingException {}
public void addCookie(Cookie cookie) {}
public void addHeader(String name, String value) {}
public void addParameter(String name, String values[]) {}
public void clearCookies() {}
public void clearHeaders() {}
public void clearLocales() {}
public void clearParameters() {}
public void recycle() {}
public void setAuthType(String authType) {}
public void setContextPath(String path) {}
public void setMethod(String method) {}
public void setRequestedSessionCookie(boolean flag) {}
public void setRequestedSessionId(String id) {}
public void setRequestedSessionURL(boolean flag) {}
public void setRequestURI(String uri) {}
public void setSecure(boolean secure) {}
public void setUserPrincipal(Principal principal) {}
public String getParameter(String name) { return null; }
public Map getParameterMap() { return null; }
public Enumeration getParameterNames() { return dummyEnum; }
public String[] getParameterValues(String name) { return null; }
public RequestDispatcher getRequestDispatcher(String path) {
return null;
}
public String getAuthType() { return null; }
public Cookie[] getCookies() { return null; }
public long getDateHeader(String name) { return -1; }
public String getHeader(String name) { return null; }
public Enumeration getHeaders(String name) { return null; }
public Enumeration getHeaderNames() { return null; }
public int getIntHeader(String name) { return -1; }
public String getMethod() { return null; }
public String getPathTranslated() { return null; }
public String getRemoteUser() { return null; }
public String getRequestedSessionId() { return null; }
public String getRequestURI() { return null; }
public void setDecodedRequestURI(String uri) {}
public StringBuffer getRequestURL() { return null; }
public HttpSession getSession() { return null; }
public HttpSession getSession(boolean create) { return null; }
public boolean isRequestedSessionIdFromCookie() { return false; }
public boolean isRequestedSessionIdFromURL() { return false; }
public boolean isRequestedSessionIdFromUrl() { return false; }
public boolean isRequestedSessionIdValid() { return false; }
public boolean isUserInRole(String role) { return false; }
public Principal getUserPrincipal() { return null; }
public String getLocalAddr() { return null; }
public String getLocalName() { return null; }
public int getLocalPort() { return -1; }
public int getRemotePort() { return -1; }
}
|