|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectFactory
URLTemplatesFactory
public abstract class URLTemplatesFactory
Access point to URL templates (an optional config file to help format
rewritten URLs) used by a TemplatedURLFormatter
via the URLRewriterService
.
Field Summary | |
---|---|
protected String |
_configFilePath
|
protected Collection |
_knownTokens
|
protected Collection |
_requiredTokens
|
static String |
ACTION_TEMPLATE
|
static String |
DEFAULT_TEMPLATE
|
static String |
DEFAULT_URL_TEMPLATE_CONFIG_FILE_PATH
Default value for path from the web app to the URL templates. |
static String |
RENDER_TEMPLATE
|
static String |
RESOURCE_TEMPLATE
|
static String |
SECURE_ACTION_TEMPLATE
|
static String |
SECURE_DEFAULT_TEMPLATE
|
static String |
SECURE_RENDER_TEMPLATE
|
static String |
SECURE_RESOURCE_TEMPLATE
|
Constructor Summary | |
---|---|
URLTemplatesFactory()
|
Method Summary | |
---|---|
abstract String |
getTemplateNameByRef(String refGroupName,
String key)
Returns URL template name of the given type (by key) from the desired reference group. |
abstract URLTemplate |
getURLTemplate(String name)
Returns URL template given the name of the template. |
abstract URLTemplate[] |
getURLTemplates()
Returns an array of the URL templates. |
static URLTemplatesFactory |
getURLTemplatesFactory(ServletContext servletContext)
Gets the URLTemplatesFactory instance from a ServletContext attribute. |
static URLTemplatesFactory |
getURLTemplatesFactory(ServletRequest servletRequest)
Gets the URLTemplatesFactory instance from a ServletRequest attribute. |
static void |
initServletContext(ServletContext servletContext,
URLTemplatesFactory templatesFactory)
Adds a given URLTemplatesFactory instance as an attribute on the ServletContext. |
static void |
initServletRequest(ServletRequest servletRequest,
URLTemplatesFactory templatesFactory)
Adds a given URLTemplatesFactory instance as an attribute on the ServletRequest. |
abstract void |
load(ServletContext servletContext)
Initialization method that parses the URL template config file to get the URL templates and template reference groups. |
void |
setConfigFilePath(String configFilePath)
Allow clients to set their own URL template config file name/path. |
void |
setKnownTokens(Collection knownTokens)
Allow clients to define a set of known tokens for the template verification. |
void |
setRequiredTokens(Collection requiredTokens)
Allow clients to define a set of required tokens for the template verification. |
Methods inherited from class Factory |
---|
getConfig, getServletContext, onCreate, reinit |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String DEFAULT_TEMPLATE
public static final String SECURE_DEFAULT_TEMPLATE
public static final String ACTION_TEMPLATE
public static final String SECURE_ACTION_TEMPLATE
public static final String RESOURCE_TEMPLATE
public static final String SECURE_RESOURCE_TEMPLATE
public static final String RENDER_TEMPLATE
public static final String SECURE_RENDER_TEMPLATE
public static final String DEFAULT_URL_TEMPLATE_CONFIG_FILE_PATH
protected String _configFilePath
protected Collection _knownTokens
protected Collection _requiredTokens
Constructor Detail |
---|
public URLTemplatesFactory()
Method Detail |
---|
public static URLTemplatesFactory getURLTemplatesFactory(ServletContext servletContext)
servletContext
- the current ServletContext.
public static void initServletContext(ServletContext servletContext, URLTemplatesFactory templatesFactory)
servletContext
- the current ServletContext.templatesFactory
- the URLTemplatesFactory instance to add as an attribute of the contextpublic static URLTemplatesFactory getURLTemplatesFactory(ServletRequest servletRequest)
servletRequest
- the current ServletRequest.
public static void initServletRequest(ServletRequest servletRequest, URLTemplatesFactory templatesFactory)
servletRequest
- the current ServletRequest.templatesFactory
- the URLTemplatesFactory instance to add as an attribute of the requestpublic void setConfigFilePath(String configFilePath)
configFilePath
- An absolute path from the web app root to the URL template config file.public void setKnownTokens(Collection knownTokens)
knownTokens
- The set of known tokens for a valid template.public void setRequiredTokens(Collection requiredTokens)
The template verification will ensure the URL template conforms to a valid format for known tokens and contains the required tokens.
requiredTokens
- The set of required tokens in a valid template.public abstract URLTemplate[] getURLTemplates()
public abstract URLTemplate getURLTemplate(String name)
name
- name of the template
public abstract String getTemplateNameByRef(String refGroupName, String key)
refGroupName
- name of a group of templates from the config file.key
- type of the template
public abstract void load(ServletContext servletContext)
servletContext
- the current ServletContext.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |