Mercurial > hg > AnnotationManagerN4J
comparison src/main/java/de/mpiwg/itgroup/annotations/restlet/BaseRestlet.java @ 80:4724fc7b4733
add slashes to paths for getRealPath to work with Tomcat 8.
author | casties |
---|---|
date | Mon, 21 Jul 2014 17:28:15 +0200 |
parents | 25eb2e1df106 |
children | e3f0613b2f2d |
comparison
equal
deleted
inserted
replaced
79:4466194a4eae | 80:4724fc7b4733 |
---|---|
348 } else { | 348 } else { |
349 // try path in webapp first | 349 // try path in webapp first |
350 String webPath = path; | 350 String webPath = path; |
351 if (!webPath.startsWith("/")) { | 351 if (!webPath.startsWith("/")) { |
352 // relative path in webapp starts in WEB-INF | 352 // relative path in webapp starts in WEB-INF |
353 webPath = "WEB-INF/" + webPath; | 353 webPath = "/WEB-INF/" + webPath; |
354 } | 354 } |
355 ps = sc.getResourceAsStream(webPath); | 355 ps = sc.getResourceAsStream(webPath); |
356 if (ps == null) { | 356 if (ps == null) { |
357 // try as file | 357 // try as file |
358 File pf = new File(sc.getRealPath(webPath)); | 358 File pf = new File(sc.getRealPath(webPath)); |
385 public static String getResourcePath(ServletContext sc, String filename) { | 385 public static String getResourcePath(ServletContext sc, String filename) { |
386 File f = new File(filename); | 386 File f = new File(filename); |
387 // is the filename absolute? | 387 // is the filename absolute? |
388 if (!f.isAbsolute() && sc != null) { | 388 if (!f.isAbsolute() && sc != null) { |
389 // relative path -> use getRealPath to resolve in webapp | 389 // relative path -> use getRealPath to resolve in webapp |
390 filename = sc.getRealPath("WEB-INF/" + filename); | 390 filename = sc.getRealPath("/WEB-INF/" + filename); |
391 } | 391 } |
392 return filename; | 392 return filename; |
393 } | 393 } |
394 | 394 |
395 /* | 395 /* |