Class PackageResourceReference
- java.lang.Object
-
- org.apache.wicket.request.resource.ResourceReference
-
- org.apache.wicket.request.resource.PackageResourceReference
-
- All Implemented Interfaces:
java.io.Serializable,org.apache.wicket.util.io.IClusterable
- Direct Known Subclasses:
CssResourceReference,JavaScriptResourceReference,MetaInfStaticResourceReference
public class PackageResourceReference extends ResourceReference
This is a ResourceReference that knows how to find and serve resources located in the Java package (i.e. next to the class files).- Author:
- Tobias Soloschenko
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.wicket.request.resource.ResourceReference
ResourceReference.Key, ResourceReference.LambdaResourceReference, ResourceReference.UrlAttributes
-
-
Constructor Summary
Constructors Constructor Description PackageResourceReference(java.lang.Class<?> scope, java.lang.String name)Construct.PackageResourceReference(java.lang.Class<?> scope, java.lang.String name, java.util.Locale locale, java.lang.String style, java.lang.String variation)Construct.PackageResourceReference(java.lang.String name)Construct.PackageResourceReference(ResourceReference.Key key)Construct.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.StringgetMinifiedName()PackageResourcegetResource()Returns the resource.ResourceReference.UrlAttributesgetUrlAttributes()Allows to specify which locale, style and variation values will the generated URL for this resource reference have.PackageResourceReferencereadBuffered(boolean readBuffered)If the package resource should be read buffered.
WARNING - if the stream is not read buffered compressors will not work, because they require the whole content to be read into memory.
(IJavaScriptCompressor,
ICssCompressor,
IScopeAwareTextResourceProcessor)protected voidremoveCompressFlagIfUnnecessary(PackageResource resource)Method allowing to remove the compress flag if the resource has been detected as a minified one (i.e.-
Methods inherited from class org.apache.wicket.request.resource.ResourceReference
canBeRegistered, equals, getDependencies, getExtension, getKey, getLocale, getName, getScope, getStyle, getVariation, hashCode, of, of, toString
-
-
-
-
Constructor Detail
-
PackageResourceReference
public PackageResourceReference(ResourceReference.Key key)
Construct.- Parameters:
key-
-
PackageResourceReference
public PackageResourceReference(java.lang.Class<?> scope, java.lang.String name, java.util.Locale locale, java.lang.String style, java.lang.String variation)Construct.- Parameters:
scope-name-locale-style-variation-
-
PackageResourceReference
public PackageResourceReference(java.lang.Class<?> scope, java.lang.String name)Construct.- Parameters:
scope-name-
-
PackageResourceReference
public PackageResourceReference(java.lang.String name)
Construct.- Parameters:
name-
-
-
Method Detail
-
getResource
public PackageResource getResource()
Description copied from class:ResourceReferenceReturns the resource.- Specified by:
getResourcein classResourceReference- Returns:
- resource instance
- See Also:
ResourceReference.getResource()
-
removeCompressFlagIfUnnecessary
protected final void removeCompressFlagIfUnnecessary(PackageResource resource)
Method allowing to remove the compress flag if the resource has been detected as a minified one (i.e. ending with .min.EXT) This method is to be called by subclasses overridinggetResourceif they want to rely on default minification detection handling see WICKET-5250 for further explanation- Parameters:
resource- resource to check
-
getMinifiedName
protected java.lang.String getMinifiedName()
- Returns:
- How the minified file should be named.
-
getUrlAttributes
public ResourceReference.UrlAttributes getUrlAttributes()
Description copied from class:ResourceReferenceAllows to specify which locale, style and variation values will the generated URL for this resource reference have.- Overrides:
getUrlAttributesin classResourceReference- Returns:
- url attributes
-
readBuffered
public PackageResourceReference readBuffered(boolean readBuffered)
If the package resource should be read buffered.
WARNING - if the stream is not read buffered compressors will not work, because they require the whole content to be read into memory.
(IJavaScriptCompressor,
ICssCompressor,
IScopeAwareTextResourceProcessor)- Parameters:
readBuffered- if the package resource should be read buffered- Returns:
- the current package resource
-
-