You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stanbol.apache.org by rw...@apache.org on 2012/12/13 08:27:54 UTC
svn commit: r1421099 -
/stanbol/trunk/commons/web/resources/src/main/java/org/apache/stanbol/commons/web/resources/ResourceServingFilter.java
Author: rwesten
Date: Thu Dec 13 07:27:53 2012
New Revision: 1421099
URL: http://svn.apache.org/viewvc?rev=1421099&view=rev
Log:
STANBOL-828: Fix for issue (1) The ResourceServingFilter does now consider the HttpServletRequest#getContextPath() when processing static resources
Modified:
stanbol/trunk/commons/web/resources/src/main/java/org/apache/stanbol/commons/web/resources/ResourceServingFilter.java
Modified: stanbol/trunk/commons/web/resources/src/main/java/org/apache/stanbol/commons/web/resources/ResourceServingFilter.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/commons/web/resources/src/main/java/org/apache/stanbol/commons/web/resources/ResourceServingFilter.java?rev=1421099&r1=1421098&r2=1421099&view=diff
==============================================================================
--- stanbol/trunk/commons/web/resources/src/main/java/org/apache/stanbol/commons/web/resources/ResourceServingFilter.java (original)
+++ stanbol/trunk/commons/web/resources/src/main/java/org/apache/stanbol/commons/web/resources/ResourceServingFilter.java Thu Dec 13 07:27:53 2012
@@ -114,16 +114,17 @@ public class ResourceServingFilter imple
}
}
}
-
-
+
private void doFilterHttp(HttpServletRequest request,
HttpServletResponse response, FilterChain chain)
throws IOException, ServletException {
final String requestPath = request.getRequestURI();
- if (path2Bundle.containsKey(requestPath)) {
+ String contextPath = request.getContextPath();
+ String resourcePatch = requestPath.substring(contextPath.length());
+ Bundle resourceBundle = path2Bundle.get(resourcePatch);
+ if (resourceBundle != null) {
if (request.getMethod().equals("GET") || request.getMethod().equals("HEAD")) {
- Bundle resourceBundle = path2Bundle.get(requestPath);
- URL url = resourceBundle.getEntry(RESOURCE_PREFIX + requestPath);
+ URL url = resourceBundle.getEntry(RESOURCE_PREFIX + resourcePatch);
String mediaType = URLConnection.guessContentTypeFromName(url.getFile());
response.setContentType(mediaType);
//TODO can we get the length of a resource without