org.apache.wicket.markup.html
Class PackageResourceGuard

java.lang.Object
  extended by org.apache.wicket.markup.html.PackageResourceGuard
All Implemented Interfaces:
IPackageResourceGuard

public class PackageResourceGuard
extends java.lang.Object
implements IPackageResourceGuard

Default implementation of IPackageResourceGuard. By default, the extensions 'properties', 'class' and 'java' are blocked and files like 'log4j.xml' and 'applicationContext.xml' A more secure implementation which by default denies access to any resource is SecurePackageResourceGuard

Author:
eelcohillenius

Constructor Summary
PackageResourceGuard()
          Construct.
 
Method Summary
 boolean accept(java.lang.Class scope, java.lang.String path)
          Whether the package resource that can be reached using the provided parameters may be accessed.
protected  boolean acceptAbsolutePath(java.lang.String path)
          Whether the provided absolute path is accepted.
protected  boolean acceptExtension(java.lang.String extension)
          Whether the provided extension is accepted.
protected  boolean acceptFile(java.lang.String file)
          Whether the provided filename is accepted.
protected  java.util.Set getBlockedExtensions()
          Gets the set of extensions that are denied access.
protected  java.util.Set getBlockedFiles()
          Gets the set of extensions that are denied access.
protected  void setBlockedExtensions(java.util.Set blockedExtensions)
          Sets the set of extensions that are denied access.
protected  void setBlockedFiles(java.util.Set blockedFiles)
          Sets the set of filenames that are denied access.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PackageResourceGuard

public PackageResourceGuard()
Construct.

Method Detail

accept

public boolean accept(java.lang.Class scope,
                      java.lang.String path)
Description copied from interface: IPackageResourceGuard
Whether the package resource that can be reached using the provided parameters may be accessed.

Specified by:
accept in interface IPackageResourceGuard
Parameters:
scope - This argument will be used to get the class loader for loading the package resource, and to determine what package it is in
path - The path to the resource
Returns:
True if access is permitted, false otherwise
See Also:
IPackageResourceGuard.accept(java.lang.Class, java.lang.String)

acceptAbsolutePath

protected boolean acceptAbsolutePath(java.lang.String path)
Whether the provided absolute path is accepted.

Parameters:
path - The absolute path, starting from the class root (packages are separated with forward slashes instead of dots).
Returns:
True if accepted, false otherwise.

acceptExtension

protected boolean acceptExtension(java.lang.String extension)
Whether the provided extension is accepted.

Parameters:
extension - The extension, starting from the class root (packages are separated with forward slashes instead of dots).
Returns:
True if accepted, false otherwise.

acceptFile

protected boolean acceptFile(java.lang.String file)
Whether the provided filename is accepted.

Parameters:
file - filename
Returns:
True if accepted, false otherwise.

getBlockedExtensions

protected final java.util.Set getBlockedExtensions()
Gets the set of extensions that are denied access.

Returns:
The set of extensions that are denied access

getBlockedFiles

protected final java.util.Set getBlockedFiles()
Gets the set of extensions that are denied access.

Returns:
The set of extensions that are denied access

setBlockedExtensions

protected final void setBlockedExtensions(java.util.Set blockedExtensions)
Sets the set of extensions that are denied access.

Parameters:
blockedExtensions - Set of extensions that are not allowed access

setBlockedFiles

protected final void setBlockedFiles(java.util.Set blockedFiles)
Sets the set of filenames that are denied access.

Parameters:
blockedFiles - Set of extensions that are denied access


Copyright © 2004-2010 Apache Software Foundation. All Rights Reserved.