|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.norther.tammi.core.pool.RecyclableSupport org.norther.tammi.core.pool.PoolableSupport org.norther.tammi.spray.engine.tool.GlobalTool org.norther.tammi.spray.engine.tool.ContextTool org.norther.tammi.spray.media.tool.MediaTool org.norther.tammi.spray.media.tool.LinkTool
public class LinkTool
A request context tool supporting creation of links to media filters.
Based on TemplateLink
in the Apache Jakarta Turbine project.
Constructor Summary | |
---|---|
LinkTool()
Constructs a new link. |
Method Summary | ||
---|---|---|
LinkTool |
addPathInfo(List<?> list)
Adds a list of name=value pairs to the path info. |
|
LinkTool |
addPathInfo(String name,
double value)
Adds a name=value pair to the path info. |
|
LinkTool |
addPathInfo(String name,
int value)
Adds a name=value pair to the path info. |
|
LinkTool |
addPathInfo(String name,
long value)
Adds a name=value pair to the path info. |
|
LinkTool |
addPathInfo(String name,
Object value)
Adds a name=value pair to the path info. |
|
LinkTool |
addPathInfo(String name,
String value)
Adds a name=value pair to the path info. |
|
LinkTool |
addQueryString(List<?> list)
Adds a list of name=value pairs to the query string. |
|
LinkTool |
addQueryString(String name)
Adds a name to the query string. |
|
LinkTool |
addQueryString(String name,
double value)
Adds a name=value pair to the query string. |
|
LinkTool |
addQueryString(String name,
int value)
Adds a name=value pair to the query string. |
|
LinkTool |
addQueryString(String name,
long value)
Adds a name=value pair to the query string. |
|
LinkTool |
addQueryString(String name,
Object value)
Adds a name=value pair to the query string. |
|
LinkTool |
addQueryString(String name,
String value)
Adds a name=value pair to the query string. |
|
boolean |
checkPermission()
Checks execute permission for the linked URL. |
|
LinkTool |
clear()
Clears all current links. |
|
LinkTool |
clearBookmark()
Clears the bookmark. |
|
LinkTool |
clearPathInfo()
Clears the path info. |
|
LinkTool |
clearQueryString()
Clears the query string. |
|
Object |
clone()
|
|
void |
dispose()
Disposes the object by setting its disposed flag. |
|
protected String |
encodePathInfo()
Encodes the path info. |
|
protected String |
encodeQueryString()
Encodes the query string. |
|
boolean |
exists()
Checks whether the linked URL exists. |
|
String |
getBookmark()
Gets the linked bookmark. |
|
protected
|
getFilter(Class<F> clazz)
Gets the first specific filter from the filter chain. |
|
String |
getHost()
Gets the linked host. |
|
protected HostFilter<?> |
getHostFilter()
Gets the host filter from the filter stack. |
|
String |
getLink()
Gets the linked link. |
|
String |
getLinkAnchor(String link)
Gets the anchor of the specified link. |
|
OrderedMap<String,String> |
getLinkAnchors()
Gets a map of link anchors for the current principal. |
|
OrderedMap<String,String> |
getLinkAnchors(boolean all)
Gets a map of all link anchors. |
|
String |
getLinkBranch()
Gets the branch key of link of the current request. |
|
protected String |
getLinked(String key)
Gets the linked value. |
|
protected LinkFilter<?> |
getLinkFilter()
Gets the link filter from the filter stack. |
|
String |
getLocale()
Gets the linked locale. |
|
String |
getPathInfo()
Gets the last component of the path info as a string. |
|
String |
getPipe()
Gets the linked pipe. |
|
String |
getPipeAnchor(String pipe)
Gets the anchor of the specified pipe. |
|
OrderedMap<String,String> |
getPipeAnchors()
Gets a map of pipe anchors for the current principal. |
|
OrderedMap<String,String> |
getPipeAnchors(boolean all)
Gets a map of all pipe anchors. |
|
String |
getPipeBranch()
Gets the branch key of pipe of the current request. |
|
protected PipeFilter<?> |
getPipeFilter()
Gets the pipe filter from the filter stack. |
|
int |
getPort()
Gets the linked port. |
|
String |
getScheme()
Gets the linked scheme. |
|
String |
getScriptName()
Gets the linked script name (context path + servlet path). |
|
String |
getService()
Gets the linked service. |
|
String |
getServiceAnchor(String service)
Gets the anchor of the specified service. |
|
OrderedMap<String,String> |
getServiceAnchors()
Gets a map of service anchors for the current principal. |
|
OrderedMap<String,String> |
getServiceAnchors(boolean all)
Gets a map of all service anchors. |
|
String |
getServiceBranch()
Gets the branch key of service of the current request. |
|
protected ServiceFilter<?> |
getServiceFilter()
Gets the service filter from the filter stack. |
|
String |
getServletPath()
Gets the linked servlet path. |
|
String |
getSource()
Gets the linked cached source. |
|
String |
getTerminal()
Gets the linked terminal. |
|
String |
getURL()
Gets the URL as a string. |
|
boolean |
isAbsolute()
Checks whether this link is absolute. |
|
boolean |
isEncoded()
Checks whether this link is encoded. |
|
protected boolean |
isPathInfoParsed()
Checks the parse path info option. |
|
boolean |
isRedirected()
Checks whether this link is a redirection. |
|
boolean |
isSecure()
Checks whether this link is secure. |
|
protected void |
linkModified()
A callback informing subclasses about a modified link. |
|
LinkTool |
removeHost()
Removes the linked host. |
|
LinkTool |
removeLink()
Removes the linked link. |
|
protected LinkTool |
removeLinked(String key)
Removes the linked value. |
|
LinkTool |
removePathInfo(String name)
Removes a name=value pair from the path info. |
|
LinkTool |
removePipe()
Removes the linked pipe. |
|
LinkTool |
removeQueryString(String name)
Removes a name=value pair from the query string. |
|
LinkTool |
removeService()
Removes the linked service. |
|
LinkTool |
reset()
Resets the default URL. |
|
LinkTool |
resetHost()
Resets the default host. |
|
LinkTool |
resetLink()
Resets the default link. |
|
LinkTool |
resetPipe()
Resets the default pipe. |
|
LinkTool |
resetService()
Resets the default service. |
|
LinkTool |
setAbsolute(boolean flag)
Sets this link to be either absolute or relative. |
|
LinkTool |
setAbsolute(Boolean flag)
Sets this link to be either absolute, relative or keep it unchanged. |
|
LinkTool |
setBookmark(String bm)
Sets the linked bookmark. |
|
LinkTool |
setEncoded(boolean flag)
Sets this link to be encoded. |
|
LinkTool |
setEncoded(Boolean flag)
Sets this link to be either encoded, decoded or keep it unchanged. |
|
LinkTool |
setHost(String host)
Sets the linked host. |
|
LinkTool |
setLink(String link)
Sets the linked link. |
|
protected LinkTool |
setLinked(String key,
String value)
Sets the linked value. |
|
LinkTool |
setLocale(String lang)
Sets the linked locale. |
|
LinkTool |
setPathInfo(String info)
Sets the last component of the path info as a string. |
|
LinkTool |
setPathInfo(String info,
boolean always)
Sets the last component of the path info as a string optionally only if the path info is not parsed. |
|
LinkTool |
setPipe(String pipe)
Sets the linked pipe. |
|
LinkTool |
setPort(int port)
Sets the linked port. |
|
LinkTool |
setRedirected(boolean flag)
Sets this link to be a redirection. |
|
LinkTool |
setRedirected(Boolean flag)
Sets this link to be either redirected, directed or keep it unchanged. |
|
LinkTool |
setScheme(String scheme)
Sets the linked scheme. |
|
LinkTool |
setScriptName(String name)
Sets the linked script name (context path + servlet path). |
|
LinkTool |
setSecure(boolean flag)
Sets this link to be either secure or non-secure. |
|
LinkTool |
setSecure(boolean flag,
int port)
Sets this link to be either secure or non-secure and to use a given port. |
|
LinkTool |
setService(String service)
Sets the linked service. |
|
LinkTool |
setServletPath(String path)
Sets the linked servlet path. |
|
LinkTool |
setSource(String source)
Sets the linked source. |
|
LinkTool |
setSource(String source,
boolean localized)
Sets the linked localized source. |
|
LinkTool |
setTerminal(String term)
Sets the linked terminal. |
|
LinkTool |
setURL(String url)
Sets the URL as a string. |
|
String |
toString()
Returns the URL as a string and clears the link to its initial state. |
|
LinkTool |
use()
Uses the current URL. |
|
LinkTool |
useTerminal()
Uses the current terminal. |
|
LinkTool |
useUser()
Uses the current user. |
Methods inherited from class org.norther.tammi.spray.media.tool.MediaTool |
---|
toMediaFile, toURL, toURL |
Methods inherited from class org.norther.tammi.spray.engine.tool.ContextTool |
---|
getFilterChain, getFilterKey, getPrincipal, getRequest, getResponse, isFilterChanged |
Methods inherited from class org.norther.tammi.spray.engine.tool.GlobalTool |
---|
getContext, getContextToolFilter, getMBeanServer, isBound, nop, valueBound, valueUnbound |
Methods inherited from class org.norther.tammi.core.pool.PoolableSupport |
---|
disposed, recycled |
Methods inherited from class org.norther.tammi.core.pool.RecyclableSupport |
---|
isDisposed, recycle |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.norther.tammi.core.pool.Recyclable |
---|
isDisposed, recycle |
Constructor Detail |
---|
public LinkTool()
Method Detail |
---|
public Object clone()
clone
in class GlobalTool
public void dispose()
RecyclableSupport
dispose
in interface Recyclable
dispose
in class ContextTool
public String getScheme()
public LinkTool setScheme(String scheme)
scheme
- the scheme.
public int getPort()
public LinkTool setPort(int port)
port
- the port.
public String getScriptName()
Note that the context path of the link URL can't be get or set alone but only as part of the script name.
public LinkTool setScriptName(String name)
Note that setting the servlet path has no effect after the script name has been set.
name
- the script name.
public String getServletPath()
public LinkTool setServletPath(String path)
Note that setting the servlet path has no effect if the script name has already been set.
path
- the servlet path.
public boolean isSecure()
public LinkTool setSecure(boolean flag)
flag
- true for a secure link, false otherwise.
public LinkTool setSecure(boolean flag, int port)
flag
- true for a secure link, false otherwise.port
- the server port.
public boolean isAbsolute()
public LinkTool setAbsolute(boolean flag)
Note that setting the flag to false does not supersede the
AbsoluteURLLinks
configuration option.
flag
- the absolute flag.
public LinkTool setAbsolute(Boolean flag)
flag
- true for an absolute link, false for a non-secure one and
null to keep unchanged.
public boolean isEncoded()
public LinkTool setEncoded(boolean flag)
flag
- the encoded flag.
public LinkTool setEncoded(Boolean flag)
flag
- true for an encoded link, false for a decoded one and null to
keep unchanged.
public boolean isRedirected()
public LinkTool setRedirected(boolean flag)
HttpServletRequest.encodeRedirectURL
method.
flag
- the redirected flag.
public LinkTool setRedirected(Boolean flag)
flag
- true for a redirected link, false for a directed one and null
to keep unchanged.
public String getBookmark()
public LinkTool setBookmark(String bm)
bm
- the bookmark.
public LinkTool clearBookmark()
public String getPathInfo()
public LinkTool setPathInfo(String info)
info
- the path info.
public LinkTool setPathInfo(String info, boolean always)
info
- the path info.always
- the always option.
public LinkTool addPathInfo(List<?> list)
list
- the list.
public LinkTool addPathInfo(String name, Object value)
name
- the name.value
- the value.
public LinkTool addPathInfo(String name, String value)
name
- the name.value
- the value.
NullPointerException
- for a null name.
IllegalArgumentException
- for a name with slashes.public LinkTool addPathInfo(String name, double value)
name
- the name.value
- the value.
public LinkTool addPathInfo(String name, int value)
name
- the name.value
- the value.
public LinkTool addPathInfo(String name, long value)
name
- the name.value
- the value.
public LinkTool removePathInfo(String name)
Note that possible dependencies are not updated, call dedicated remove methods when applicable.
name
- the name to be removed.
public LinkTool clearPathInfo()
public LinkTool addQueryString(List<?> list)
list
- the list.
public LinkTool addQueryString(String name)
name
- the name.
public LinkTool addQueryString(String name, Object value)
name
- the name.value
- the value.
public LinkTool addQueryString(String name, String value)
name
- the name.value
- the value.
NullPointerException
- for a null name.public LinkTool addQueryString(String name, double value)
name
- the name.value
- the value.
public LinkTool addQueryString(String name, int value)
name
- the name.value
- the value.
public LinkTool addQueryString(String name, long value)
name
- the name.value
- the value.
public LinkTool removeQueryString(String name)
Note that possible dependencies are not updated, call dedicated remove methods when applicable.
name
- the name to be removed.
public LinkTool clearQueryString()
public String getHost()
public LinkTool resetHost()
public LinkTool setHost(String host)
host
- the host.
public LinkTool removeHost()
public LinkTool resetService()
public String getService()
public LinkTool setService(String service)
service
- the service.
NullPointerException
- if not settable.public LinkTool removeService()
public String getServiceBranch()
public String getServiceAnchor(String service)
service
- the service.
public OrderedMap<String,String> getServiceAnchors()
public OrderedMap<String,String> getServiceAnchors(boolean all)
all
- true for all links, false for authorized links.
public LinkTool resetPipe()
public String getPipe()
public LinkTool setPipe(String pipe)
pipe
- the pipe.
NullPointerException
- if not settable.public LinkTool removePipe()
public String getPipeBranch()
public String getPipeAnchor(String pipe)
pipe
- the pipe.
public OrderedMap<String,String> getPipeAnchors()
public OrderedMap<String,String> getPipeAnchors(boolean all)
all
- true for all links, false for authorized links.
public LinkTool resetLink()
public String getLink()
public LinkTool setLink(String link)
link
- the link.
NullPointerException
- if not settable.public LinkTool removeLink()
public String getLinkBranch()
public String getLinkAnchor(String link)
link
- the link.
public OrderedMap<String,String> getLinkAnchors()
public OrderedMap<String,String> getLinkAnchors(boolean all)
all
- true for all links, false for authorized links.
public String getLocale()
public LinkTool setLocale(String lang)
lang
- the locale.
public LinkTool useTerminal()
public String getTerminal()
public LinkTool setTerminal(String term)
term
- the terminal.
public String getSource()
public LinkTool setSource(String source)
source
- the source.
public LinkTool setSource(String source, boolean localized)
Note that search for localized sources is available only if the content filter is configured to support localized content.
source
- the source.localized
- true for a localized source.
public LinkTool useUser()
public String getURL()
Note that the link is not XML encoded but the caller is responsible for pre- or post-processing the link for the target environment.
public LinkTool reset()
public LinkTool use()
public LinkTool setURL(String url)
Note that the link may be a full or partial URL and the scheme, host, port and script name of the current link URL are updated accordingly. The path info and query string are cleared before setting the URL.
url
- the link URL.
public String toString()
Note that the link is not XML encoded but the caller is responsible for pre- or post-processing the link for the target environment.
toString
in class GlobalTool
public LinkTool clear()
public boolean exists()
public boolean checkPermission()
protected void linkModified()
protected String getLinked(String key)
key
- the linked key.
protected LinkTool setLinked(String key, String value)
key
- the linked key.value
- the linked value.
protected LinkTool removeLinked(String key)
key
- the linked key.
protected String encodePathInfo()
protected String encodeQueryString()
protected boolean isPathInfoParsed()
protected HostFilter<?> getHostFilter()
protected ServiceFilter<?> getServiceFilter()
protected PipeFilter<?> getPipeFilter()
protected LinkFilter<?> getLinkFilter()
protected <F extends Filter> F getFilter(Class<F> clazz)
ContextTool
getFilter
in class ContextTool
F
- the filter type.clazz
- the class or interface of the filter.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |