org.apache.wicket.markup.html
Class JavascriptPackageResource

java.lang.Object
  extended by org.apache.wicket.Resource
      extended by org.apache.wicket.markup.html.WebResource
          extended by org.apache.wicket.markup.html.PackageResource
              extended by org.apache.wicket.markup.html.CompressedPackageResource
                  extended by org.apache.wicket.markup.html.JavascriptPackageResource
All Implemented Interfaces:
Serializable, IClusterable, IRequestListener, IResourceListener, IPackageResourceGuard, IModifiable

public class JavascriptPackageResource
extends CompressedPackageResource

Package resource for javascript files. It strips comments and whitespace from javascript and gzips the content. The stripped and gzipped version is cached.

Author:
Matej Knopp
See Also:
Serialized Form

Nested Class Summary
protected  class JavascriptPackageResource.FilteringResourceStream
          Resource Stream that caches the stripped content.
 
Nested classes/interfaces inherited from class org.apache.wicket.markup.html.CompressedPackageResource
CompressedPackageResource.CompressingResourceStream
 
Nested classes/interfaces inherited from class org.apache.wicket.markup.html.PackageResource
PackageResource.PackageResourceBlockedException
 
Field Summary
 
Fields inherited from class org.apache.wicket.markup.html.PackageResource
EXTENSION_CSS, EXTENSION_JS
 
Fields inherited from interface org.apache.wicket.IResourceListener
INTERFACE
 
Constructor Summary
protected JavascriptPackageResource(Class<?> scope, String path, Locale locale, String style)
          Creates a new javascript package resource.
 
Method Summary
static HeaderContributor getHeaderContribution(Class<?> scope, String path)
          Returns a new instance of HeaderContributor with a header contributor that references a java script file that lives in a package.
static HeaderContributor getHeaderContribution(ResourceReference reference)
          Returns a new instance of HeaderContributor with a header contributor that references a java script file that lives in a package.
static HeaderContributor getHeaderContribution(String location)
          Returns a new instance of HeaderContributor with a header contributor referencing a java script file using one of the following schemes: Starts with http:// or https:// for an external reference. Starts with "/" for an absolute reference that Wicket will not rewrite. Starts with anything else, which Wicket will automatically prepend to make relative to the context root of your web-app.
static PackageResource newPackageResource(Class<?> scope, String path, Locale locale, String style)
          Create a new PackageResource
protected  IResourceStream newResourceStream()
          Factory method for creating resource stream instance
 
Methods inherited from class org.apache.wicket.markup.html.CompressedPackageResource
getPackageResourceStream, getResourceStream, setHeaders
 
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, toString
 
Methods inherited from class org.apache.wicket.markup.html.WebResource
configureResponse, getCacheDuration
 
Methods inherited from class org.apache.wicket.Resource
getParameters, invalidate, isCacheable, onResourceRequested, setCacheable, setParameters
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JavascriptPackageResource

protected JavascriptPackageResource(Class<?> scope,
                                    String path,
                                    Locale locale,
                                    String style)
Creates a new javascript package resource.

Parameters:
scope -
path -
locale -
style -
Method Detail

getHeaderContribution

public static final HeaderContributor getHeaderContribution(Class<?> scope,
                                                            String path)
Returns a new instance of HeaderContributor with a header contributor that references a java script file that lives in a package.

Parameters:
scope - The scope of the package resource (typically the class of the caller, or a class that lives in the package where the resource lives).
path - The path
Returns:
the new header contributor instance

getHeaderContribution

public static final HeaderContributor getHeaderContribution(ResourceReference reference)
Returns a new instance of HeaderContributor with a header contributor that references a java script file that lives in a package.

Parameters:
reference -
Returns:
the new header contributor instance

getHeaderContribution

public static final HeaderContributor getHeaderContribution(String location)
Returns a new instance of HeaderContributor with a header contributor referencing a java script file using one of the following schemes:

Parameters:
location - The location of the java script file.
Returns:
the new header contributor instance

newPackageResource

public static PackageResource newPackageResource(Class<?> scope,
                                                 String path,
                                                 Locale locale,
                                                 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 method
path - The path to the resource
locale - The locale of the resource
style - The style of the resource (see Session)
Returns:
The resource

newResourceStream

protected IResourceStream newResourceStream()
Description copied from class: CompressedPackageResource
Factory method for creating resource stream instance

Overrides:
newResourceStream in class CompressedPackageResource
Returns:
new stream instance
See Also:
CompressedPackageResource.newResourceStream()


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