comparison src/org/eclipse/jetty/server/handler/ResourceHandler.java @ 997:7d28be82ab75

simplify Request
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 18 Oct 2016 22:43:17 -0600
parents 4e9d373bf6e9
children 32d4b569567c
comparison
equal deleted inserted replaced
996:d9cfec64899c 997:7d28be82ab75
250 public void setCacheControl(String cacheControl) 250 public void setCacheControl(String cacheControl)
251 { 251 {
252 _cacheControl=cacheControl==null?null:new ByteArrayBuffer(cacheControl); 252 _cacheControl=cacheControl==null?null:new ByteArrayBuffer(cacheControl);
253 } 253 }
254 254
255 private Resource getResource(Request request,String path) throws MalformedURLException 255 private Resource getResource(Request request) throws MalformedURLException
256 { 256 {
257 String path = request.getPathInfo();
257 if (path==null || !path.startsWith("/")) 258 if (path==null || !path.startsWith("/"))
258 throw new MalformedURLException(path); 259 throw new MalformedURLException(path);
259 260
260 Resource base = _baseResource; 261 Resource base = _baseResource;
261 if (base==null) 262 if (base==null)
277 { 278 {
278 LOG.trace("",e); 279 LOG.trace("",e);
279 } 280 }
280 281
281 return null; 282 return null;
282 }
283
284 private Resource getResource(Request request) throws MalformedURLException
285 {
286 String servletPath;
287 String pathInfo;
288 Boolean included = request.getAttribute(RequestDispatcher.INCLUDE_REQUEST_URI) != null;
289 if (included != null && included.booleanValue())
290 {
291 servletPath = (String)request.getAttribute(RequestDispatcher.INCLUDE_SERVLET_PATH);
292 pathInfo = (String)request.getAttribute(RequestDispatcher.INCLUDE_PATH_INFO);
293
294 if (servletPath == null && pathInfo == null)
295 {
296 servletPath = request.getServletPath();
297 pathInfo = request.getPathInfo();
298 }
299 }
300 else
301 {
302 servletPath = request.getServletPath();
303 pathInfo = request.getPathInfo();
304 }
305
306 String pathInContext = URIUtil.addPaths(servletPath,pathInfo);
307 return getResource(request,pathInContext);
308 } 283 }
309 284
310 285
311 /* ------------------------------------------------------------ */ 286 /* ------------------------------------------------------------ */
312 public String[] getWelcomeFiles() 287 public String[] getWelcomeFiles()