1 29 30 package com.caucho.server.dispatch; 31 32 import com.caucho.log.Log; 33 import com.caucho.util.L10N; 34 35 import javax.servlet.FilterChain ; 36 import javax.servlet.ServletException ; 37 import javax.servlet.ServletRequest ; 38 import javax.servlet.ServletResponse ; 39 import java.io.IOException ; 40 import java.util.HashMap ; 41 import java.util.logging.Logger ; 42 43 46 public class ServletInvocation { 47 static final Logger log = Log.open(ServletInvocation.class); 48 static final L10N L = new L10N(ServletInvocation.class); 49 50 private ClassLoader _classLoader; 51 52 private String _contextPath = ""; 53 54 private String _contextUri; 55 private String _servletPath; 56 private String _pathInfo; 57 58 private String _queryString; 59 60 private String _servletName; 61 private FilterChain _filterChain; 62 63 private HashMap <String ,String > _securityRoleMap; 64 65 70 public ServletInvocation() 71 { 72 _classLoader = Thread.currentThread().getContextClassLoader(); 73 } 74 75 78 public final String getContextPath() 79 { 80 return _contextPath; 81 } 82 83 86 public void setContextPath(String path) 87 { 88 _contextPath = path; 89 } 90 91 public void setContextURI(String contextURI) 92 { 93 _contextUri = contextURI; 94 _servletPath = contextURI; 95 } 96 97 100 public final String getContextURI() 101 { 102 return _contextUri; 103 } 104 105 108 public final String getServletPath() 109 { 110 return _servletPath; 111 } 112 113 116 public void setServletPath(String servletPath) 117 { 118 _servletPath = servletPath; 119 } 120 121 124 public final String getPathInfo() 125 { 126 return _pathInfo; 127 } 128 129 132 public void setPathInfo(String pathInfo) 133 { 134 _pathInfo = pathInfo; 135 } 136 137 140 public final String getQueryString() 141 { 142 return _queryString; 143 } 144 145 148 public final void setQueryString(String queryString) 149 { 150 _queryString = queryString; 151 } 152 153 156 public void setClassLoader(ClassLoader loader) 157 { 158 _classLoader = loader; 159 } 160 161 164 public ClassLoader getClassLoader() 165 { 166 return _classLoader; 167 } 168 169 172 public void setServletName(String servletName) 173 { 174 _servletName = servletName; 175 } 176 177 180 public String getServletName() 181 { 182 return _servletName; 183 } 184 185 188 public void setFilterChain(FilterChain chain) 189 { 190 _filterChain = chain; 191 } 192 193 196 public FilterChain getFilterChain() 197 { 198 return _filterChain; 199 } 200 201 204 public HashMap <String ,String > getSecurityRoleMap() 205 { 206 return _securityRoleMap; 207 } 208 209 212 public void setSecurityRoleMap(HashMap <String ,String > roleMap) 213 { 214 _securityRoleMap = roleMap; 215 } 216 217 223 public void service(ServletRequest request, ServletResponse response) 224 throws IOException , ServletException 225 { 226 _filterChain.doFilter(request, response); 227 } 228 229 232 public void copyFrom(ServletInvocation invocation) 233 { 234 _classLoader = invocation._classLoader; 235 _contextPath = invocation._contextPath; 236 237 _contextUri = invocation._contextUri; 238 _servletPath = invocation._servletPath; 239 _pathInfo = invocation._pathInfo; 240 241 _queryString = invocation._queryString; 242 243 _servletName = invocation._servletName; 244 _filterChain = invocation._filterChain; 245 } 246 247 public String toString() 248 { 249 return "ServletInvocation[" + _contextUri + "]"; 250 } 251 } 252 | Popular Tags |