Search in sources :

Example 1 with IFixedLocationResourceStream

use of org.apache.wicket.util.resource.IFixedLocationResourceStream in project wicket by apache.

the class PackageResource method internalGetResourceStream.

private IResourceStream internalGetResourceStream(final String style, final Locale locale) {
    IResourceStreamLocator resourceStreamLocator = Application.get().getResourceSettings().getResourceStreamLocator();
    IResourceStream resourceStream = resourceStreamLocator.locate(getScope(), absolutePath, style, variation, locale, null, false);
    String realPath = absolutePath;
    if (resourceStream instanceof IFixedLocationResourceStream) {
        realPath = ((IFixedLocationResourceStream) resourceStream).locationAsString();
        if (realPath != null) {
            int index = realPath.indexOf(absolutePath);
            if (index != -1) {
                realPath = realPath.substring(index);
            }
        } else {
            realPath = absolutePath;
        }
    }
    if (accept(realPath) == false) {
        throw new PackageResourceBlockedException("Access denied to (static) package resource " + absolutePath + ". See IPackageResourceGuard");
    }
    if (resourceStream != null) {
        resourceStream = new ProcessingResourceStream(resourceStream);
    }
    return resourceStream;
}
Also used : IResourceStream(org.apache.wicket.util.resource.IResourceStream) IResourceStreamLocator(org.apache.wicket.core.util.resource.locator.IResourceStreamLocator) IFixedLocationResourceStream(org.apache.wicket.util.resource.IFixedLocationResourceStream)

Aggregations

IResourceStreamLocator (org.apache.wicket.core.util.resource.locator.IResourceStreamLocator)1 IFixedLocationResourceStream (org.apache.wicket.util.resource.IFixedLocationResourceStream)1 IResourceStream (org.apache.wicket.util.resource.IResourceStream)1