From: <jbo...@li...> - 2005-09-10 10:16:54
|
Author: adamw Date: 2005-09-10 06:16:49 -0400 (Sat, 10 Sep 2005) New Revision: 1079 Modified: trunk/forge/portal-extensions/forge-file-access/src/java/org/jboss/forge/fileaccess/FileAccessFilter.java Log: JBLAB-281: Added url decoding for kosmos cache access Modified: trunk/forge/portal-extensions/forge-file-access/src/java/org/jboss/forge/fileaccess/FileAccessFilter.java =================================================================== --- trunk/forge/portal-extensions/forge-file-access/src/java/org/jboss/forge/fileaccess/FileAccessFilter.java 2005-09-10 03:50:09 UTC (rev 1078) +++ trunk/forge/portal-extensions/forge-file-access/src/java/org/jboss/forge/fileaccess/FileAccessFilter.java 2005-09-10 10:16:49 UTC (rev 1079) @@ -11,6 +11,7 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import java.net.URLDecoder; import javax.activation.MimetypesFileTypeMap; import javax.servlet.Filter; @@ -50,6 +51,7 @@ * enabled to download. */ private final static String FREEZONE_ACCESS = "/freezone/"; + private final static String KOSMOS_CACHE_ACCESS = "/kosmos-cache/"; /** * <code>BUF_SIZE</code> - size of a buffer, which is used while reading a * file and sending it to the client. @@ -79,6 +81,7 @@ if ((toCheck.indexOf(IMAGES_ACCESS) != -1) || (toCheck.indexOf(DOWNLOADS_ACCESS) != -1) + || (toCheck.indexOf(KOSMOS_CACHE_ACCESS) != -1) || (toCheck.indexOf(FREEZONE_ACCESS) != -1)) { // Allowing access to images, downloads and docs } else @@ -97,6 +100,11 @@ * want to get the part /path/to/resource. */ String requestedRes = requestURI.split("[/]", 3)[2]; + + // Decoding the requested resource name for kosmos-cache + if (requestedRes.indexOf(KOSMOS_CACHE_ACCESS) != -1) { + requestedRes = URLDecoder.decode(requestedRes, "utf-8"); + } // The last token is the filename. String[] tokens = requestURI.split("[/]"); |