org.apache.wicket.markup.html
Class CompressedPackageResource
java.lang.Object
org.apache.wicket.Resource
org.apache.wicket.markup.html.WebResource
org.apache.wicket.markup.html.PackageResource
org.apache.wicket.markup.html.CompressedPackageResource
- All Implemented Interfaces:
- java.io.Serializable, IClusterable, IRequestListener, IResourceListener, IPackageResourceGuard, IModifiable
- Direct Known Subclasses:
- JavascriptPackageResource
public class CompressedPackageResource
- extends PackageResource
Identical to PackageResource, but supports gzip compression of data
See PackageResource
and CompressedResourceReference
- Author:
- Janne Hietamäki
- See Also:
- Serialized Form
Constructor Summary |
protected |
CompressedPackageResource(java.lang.Class scope,
java.lang.String path,
java.util.Locale locale,
java.lang.String style)
Hidden constructor. |
Methods inherited from class org.apache.wicket.markup.html.PackageResource |
accept, bind, bind, bind, bind, bind, exists, get, get, get, get, getAbsolutePath, getLocale, getPath, getResourceStream, getScope, getStyle, lastModifiedTime |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CompressedPackageResource
protected CompressedPackageResource(java.lang.Class scope,
java.lang.String path,
java.util.Locale locale,
java.lang.String style)
- Hidden constructor.
- Parameters:
scope
- This argument will be used to get the class loader for loading the package
resource, and to determine what package it is inpath
- The path to the resourcelocale
- The locale of the resourcestyle
- The style of the resource
newPackageResource
protected static PackageResource newPackageResource(java.lang.Class scope,
java.lang.String path,
java.util.Locale locale,
java.lang.String style)
- Create a new PackageResource
- 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. Typically this is the class in
which you call this methodpath
- The path to the resourcelocale
- The locale of the resourcestyle
- The style of the resource (see Session
)
- Returns:
- The resource
newResourceStream
protected IResourceStream newResourceStream()
- Factory method for creating resource stream instance
- Returns:
- new stream instance
getPackageResourceStream
protected IResourceStream getPackageResourceStream()
- Returns the resource stream of package resource
- Returns:
- resource stream
getResourceStream
public IResourceStream getResourceStream()
- IResourceStream implementation which compresses the data with gzip if the requests header
Accept-Encoding contains string gzip
- Overrides:
getResourceStream
in class PackageResource
- Returns:
- Gets the resource for the component.
- See Also:
PackageResource.getResourceStream()
setHeaders
protected void setHeaders(WebResponse response)
- Description copied from class:
WebResource
- Subclasses can override this to set there headers when the resource is being served. By
default 2 headers will be set if the Resource is cacheable
response.setDateHeader("Expires", System.currentTimeMillis() + (3600 * 1000));
response.setHeader("Cache-Control", "max-age=" + 3600);
So if a resource wants to control this or doesn't want to set this info it should override
this method and don't call super.
- Overrides:
setHeaders
in class WebResource
- Parameters:
response
- The WebResponse where set(Date)Header can be called on.- See Also:
WebResource.setHeaders(org.apache.wicket.protocol.http.WebResponse)
Copyright © 2004-2010 Apache Software Foundation. All Rights Reserved.