|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.wicket.SharedResources
public class SharedResources
Class which holds shared resources. Resources can be shared by name. An optional scope can be given to prevent naming conflicts and a locale and/or style can be given as well.
Unlike component hosted resources, shared resources have stable URLs, which makes them suitable
for indexing by web crawlers and caching by web browsers. As they are also not synchronised on
the Session
, they can be loaded asynchronously, which is important with images and
resources such as JavaScript and CSS.
Resource
Method Summary | |
---|---|
void |
add(Class<?> scope,
String name,
Locale locale,
String style,
Resource resource)
Adds a resource. |
void |
add(String name,
Locale locale,
Resource resource)
Adds a resource. |
void |
add(String name,
Resource resource)
Adds a resource. |
Resource |
get(Class<?> scope,
String name,
Locale locale,
String style,
boolean exact)
|
Resource |
get(String key)
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. |
Class<?> |
getAliasClass(String alias)
Gets the class for a given resource alias. |
boolean |
isThrowExceptionIfNotMapped()
|
void |
putClassAlias(Class<?> clz,
String alias)
Sets an alias for a class so that a resource url can look like: resources/images/Image.jpg instead of resources/org.apache.wicket.resources.ResourceClass/Image.jpg |
void |
remove(String key)
Removes a shared resource. |
String |
resourceKey(Class<?> scope,
String path,
Locale locale,
String style)
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. |
static String |
resourceKey(String path,
Locale locale,
String style)
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. |
void |
setThrowExceptionIfNotMapped(boolean throwExceptionIfNotMapped)
Set to true, if an exception shall be thrown if no alias has been defined for the class and thus the fully-qualified-class name is exposed in the URL. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static String resourceKey(String path, Locale locale, String style)
Inserts _[locale] and _[style] into path just before any extension that might exist.
path
- The resource pathlocale
- The localestyle
- The style (see Session
)
public final void add(Class<?> scope, String name, Locale locale, String style, Resource resource)
scope
- Scope of resourcename
- Logical name of resourcelocale
- The locale of the resourcestyle
- The resource style (see Session
)resource
- Resource to storepublic final void add(String name, Locale locale, Resource resource)
name
- Logical name of resourcelocale
- The locale of the resourceresource
- Resource to storepublic final void add(String name, Resource resource)
name
- Logical name of resourceresource
- Resource to storepublic final Resource get(Class<?> scope, String name, Locale locale, String style, boolean exact)
scope
- The resource's scopename
- Name of resource to getlocale
- The locale of the resourcestyle
- The resource style (see Session
)exact
- If true then only return the resource that is registered for the given locale and
style.
public final Resource get(String key)
key
- Shared resource key
public final void putClassAlias(Class<?> clz, String alias)
clz
- The class that has to be aliased.alias
- The alias string.public final Class<?> getAliasClass(String alias)
alias
-
putClassAlias(Class, String)
public final void remove(String key)
key
- Shared resource keypublic String resourceKey(Class<?> scope, String path, Locale locale, String style)
scope
- The scope of the resourcepath
- The resource pathlocale
- The localestyle
- The style (see Session
)
public boolean isThrowExceptionIfNotMapped()
public void setThrowExceptionIfNotMapped(boolean throwExceptionIfNotMapped)
throwExceptionIfNotMapped
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |