Mercurial Hosting > luan
comparison src/org/eclipse/jetty/server/handler/ContextHandler.java @ 997:7d28be82ab75
simplify Request
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 18 Oct 2016 22:43:17 -0600 |
parents | 0eba8f555c19 |
children | 32d4b569567c |
comparison
equal
deleted
inserted
replaced
996:d9cfec64899c | 997:7d28be82ab75 |
---|---|
182 } | 182 } |
183 | 183 |
184 @Override | 184 @Override |
185 public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException | 185 public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException |
186 { | 186 { |
187 if (LOG.isDebugEnabled()) | |
188 LOG.debug("scope {}|{}|{} @ {}",baseRequest.getContextPath(),baseRequest.getServletPath(),baseRequest.getPathInfo(),this); | |
189 | |
190 String old_context_path = null; | 187 String old_context_path = null; |
191 String old_servlet_path = null; | |
192 String old_path_info = null; | 188 String old_path_info = null; |
193 String pathInfo = target; | 189 String pathInfo = target; |
194 | 190 |
195 ContextHandler oldContextHandler = baseRequest._contextHandler; | 191 ContextHandler oldContextHandler = baseRequest._contextHandler; |
196 | 192 |
219 } | 215 } |
220 | 216 |
221 try | 217 try |
222 { | 218 { |
223 old_context_path = baseRequest.getContextPath(); | 219 old_context_path = baseRequest.getContextPath(); |
224 old_servlet_path = baseRequest.getServletPath(); | |
225 old_path_info = baseRequest.getPathInfo(); | 220 old_path_info = baseRequest.getPathInfo(); |
226 | 221 |
227 // Update the paths | 222 // Update the paths |
228 baseRequest._contextHandler = this; | 223 baseRequest._contextHandler = this; |
229 if (target.startsWith("/")) | 224 if (target.startsWith("/")) |
230 { | 225 { |
231 if (_contextPath.length() == 1) | 226 if (_contextPath.length() == 1) |
232 baseRequest.setContextPath(""); | 227 baseRequest.setContextPath(""); |
233 else | 228 else |
234 baseRequest.setContextPath(_contextPath); | 229 baseRequest.setContextPath(_contextPath); |
235 baseRequest.setServletPath(null); | |
236 baseRequest.setPathInfo(pathInfo); | 230 baseRequest.setPathInfo(pathInfo); |
237 } | 231 } |
238 | |
239 if (LOG.isDebugEnabled()) | |
240 LOG.debug("context={}|{}|{} @ {}",baseRequest.getContextPath(),baseRequest.getServletPath(), baseRequest.getPathInfo(),this); | |
241 | 232 |
242 try | 233 try |
243 { | 234 { |
244 super.handle(target,baseRequest,request,response); | 235 super.handle(target,baseRequest,request,response); |
245 } | 236 } |
255 if (oldContextHandler != this) | 246 if (oldContextHandler != this) |
256 { | 247 { |
257 // reset the context and servlet path. | 248 // reset the context and servlet path. |
258 baseRequest._contextHandler = oldContextHandler; | 249 baseRequest._contextHandler = oldContextHandler; |
259 baseRequest.setContextPath(old_context_path); | 250 baseRequest.setContextPath(old_context_path); |
260 baseRequest.setServletPath(old_servlet_path); | |
261 baseRequest.setPathInfo(old_path_info); | 251 baseRequest.setPathInfo(old_path_info); |
262 } | 252 } |
263 } | 253 } |
264 } | 254 } |
265 | 255 |