"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "tapestry-core/src/main/java/org/apache/tapestry5/internal/services/assets/ClasspathAssetRequestHandler.java" between
apache-tapestry-5.6.2-sources.zip and apache-tapestry-5.6.3-sources.zip

About: Apache Tapestry is a framework for creating dynamic, robust, highly scalable web applications in Java. Source code.

ClasspathAssetRequestHandler.java  (apache-tapestry-5.6.2-sources):ClasspathAssetRequestHandler.java  (apache-tapestry-5.6.3-sources)
skipping to change at line 25 skipping to change at line 25
package org.apache.tapestry5.internal.services.assets; package org.apache.tapestry5.internal.services.assets;
import org.apache.tapestry5.internal.services.ResourceStreamer; import org.apache.tapestry5.internal.services.ResourceStreamer;
import org.apache.tapestry5.ioc.Resource; import org.apache.tapestry5.ioc.Resource;
import org.apache.tapestry5.services.AssetSource; import org.apache.tapestry5.services.AssetSource;
import org.apache.tapestry5.services.ClasspathAssetAliasManager; import org.apache.tapestry5.services.ClasspathAssetAliasManager;
import org.apache.tapestry5.services.ClasspathAssetProtectionRule; import org.apache.tapestry5.services.ClasspathAssetProtectionRule;
import org.apache.tapestry5.services.Request; import org.apache.tapestry5.services.Request;
import org.apache.tapestry5.services.Response; import org.apache.tapestry5.services.Response;
import org.apache.tapestry5.services.assets.AssetRequestHandler; import org.apache.tapestry5.services.assets.AssetRequestHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException; import java.io.IOException;
/** /**
* A handler for asset requests for classpath assets (within a specific folder). * A handler for asset requests for classpath assets (within a specific folder).
* Each mapping of the {@link ClasspathAssetAliasManager} gets one of these. * Each mapping of the {@link ClasspathAssetAliasManager} gets one of these.
* *
* @since 5.2.0 * @since 5.2.0
*/ */
public class ClasspathAssetRequestHandler implements AssetRequestHandler public class ClasspathAssetRequestHandler implements AssetRequestHandler
{ {
private final static Logger LOGGER = LoggerFactory.getLogger(ClasspathAssetR
equestHandler.class);
private final ResourceStreamer streamer; private final ResourceStreamer streamer;
private final AssetSource assetSource; private final AssetSource assetSource;
private final String baseFolder; private final String baseFolder;
private final ClasspathAssetProtectionRule classpathAssetProtectionRule; private final ClasspathAssetProtectionRule classpathAssetProtectionRule;
public ClasspathAssetRequestHandler(ResourceStreamer streamer, public ClasspathAssetRequestHandler(ResourceStreamer streamer,
AssetSource assetSource, String baseFold er, AssetSource assetSource, String baseFold er,
skipping to change at line 59 skipping to change at line 64
this.assetSource = assetSource; this.assetSource = assetSource;
this.baseFolder = baseFolder; this.baseFolder = baseFolder;
this.classpathAssetProtectionRule = classpathAssetProtectionRule; this.classpathAssetProtectionRule = classpathAssetProtectionRule;
} }
public boolean handleAssetRequest(Request request, Response response, String extraPath) throws IOException public boolean handleAssetRequest(Request request, Response response, String extraPath) throws IOException
{ {
ChecksumPath path = new ChecksumPath(streamer, baseFolder, extraPath); ChecksumPath path = new ChecksumPath(streamer, baseFolder, extraPath);
final boolean handled; final boolean handled;
if (classpathAssetProtectionRule.block(path.resourcePath)) if (classpathAssetProtectionRule.block(path.resourcePath) && !path.resou rcePath.equals(ChecksumPath.NON_EXISTING_RESOURCE))
{ {
if (LOGGER.isWarnEnabled())
{
LOGGER.warn("Blocked request for classpath asset '" + path.resou
rcePath +
"'. Contribute a new ClasspathAssetProtectionRule if you
need this asset to be publicly accessible.");
}
handled = false; handled = false;
} }
else else
{ {
Resource resource = assetSource.resourceForPath(path.resourcePath); Resource resource = assetSource.resourceForPath(path.resourcePath);
handled = path.stream(resource); handled = path.stream(resource);
} }
return handled; return handled;
} }
 End of changes. 4 change blocks. 
1 lines changed or deleted 14 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)