|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectit.eng.spago.taglib.TagUtils
public class TagUtils
Provides helper methods for JSP tags.
Field Summary | |
---|---|
static java.lang.String |
CHARACTERS_KEY
Constants used to ask the an envelop characters instead
of a specific attribute. |
protected static MessageBundleReference |
messages
The message resources for this package. |
Constructor Summary | |
---|---|
protected |
TagUtils()
Constructor for TagUtils. |
Method Summary | |
---|---|
java.util.List |
computeParameters(PageContext pageContext,
java.lang.String paramId,
java.lang.String paramName,
java.lang.String paramScope,
java.lang.String property,
java.lang.String scope,
boolean transaction)
Compute a set of query parameters that will be dynamically added to a generated URL. |
java.lang.String |
computeURL(PageContext pageContext,
java.lang.String href,
java.util.List params,
java.lang.String anchor,
boolean redirect)
|
java.lang.String |
computeURL(PageContext pageContext,
java.lang.String href,
java.util.List params,
java.lang.String anchor,
boolean redirect,
boolean encodeSeparator)
|
java.lang.String |
computeURLWithCharEncoding(PageContext pageContext,
java.lang.String href,
java.util.List params,
java.lang.String anchor,
boolean redirect,
boolean useLocalEncoding)
Compute a hyperlink URL based on the href parameter
that is not null. |
java.lang.String |
computeURLWithCharEncoding(PageContext pageContext,
java.lang.String href,
java.util.List params,
java.lang.String anchor,
boolean redirect,
boolean encodeSeparator,
boolean useLocalSeparator)
|
java.lang.String |
computeURLWithCharEncoding(PageContext pageContext,
java.lang.String href,
java.util.List params,
java.lang.String anchor,
boolean redirect,
java.lang.String alias,
java.lang.String aliasRelative,
boolean encodeSeparator,
boolean useLocalEncoding)
Compute a hyperlink URL based on the href parameter
that is not null. |
java.lang.String |
encodeURL(java.lang.String url)
URLencodes a string assuming the character encoding is UTF-8. |
java.lang.String |
encodeURL(java.lang.String url,
java.lang.String enc)
Use the new URLEncoder.encode() method from Java 1.4 if available, else use the old deprecated version. |
java.lang.String |
filter(java.lang.String value)
Filter the specified string for characters that are senstive to HTML interpreters, returning the string with these characters replaced by the corresponding character entities. |
java.lang.String |
getActionMappingName(java.lang.String action)
Return the form action converted into an action mapping path. |
static TagUtils |
getInstance()
Returns the Singleton instance of TagUtils. |
RequestContextIFace |
getRequestContext(PageContext pageContext)
|
boolean |
isXhtml(PageContext pageContext)
Returns true if the custom tags are in XHTML mode. |
java.util.List |
lookupMultipleProperty(PageContext pageContext,
java.lang.String property,
java.lang.String scopeName)
|
java.util.List |
lookupMultipleProperty(PageContext pageContext,
java.lang.String property,
java.lang.String scopeName,
java.lang.String paramName,
java.lang.String paramValue,
java.lang.String listAttribute)
|
java.lang.Object |
lookupProperty(PageContext pageContext,
java.lang.String property,
java.lang.String scopeName)
|
java.lang.Object |
lookupProperty(PageContext pageContext,
java.lang.String property,
java.lang.String scopeName,
boolean emptyStringValue)
|
java.lang.String |
message(java.lang.String bundle,
java.util.Locale locale,
java.lang.String key)
Look up and return a message string, based on the specified parameters. |
java.lang.String |
message(java.lang.String bundle,
java.lang.String key)
Look up and return a message string, based on the specified parameters. |
java.lang.String |
message(java.lang.String bundle,
java.lang.String key,
java.lang.Object[] args)
Look up and return a message string, based on the specified parameters. |
void |
saveException(PageContext pageContext,
java.lang.Throwable exception)
Save the specified exception as a request attribute for later use. |
static void |
setInstance(TagUtils instance)
Set the instance. |
void |
write(PageContext pageContext,
java.lang.String text)
Write the specified text as the response to the writer associated with this page. |
void |
writePrevious(PageContext pageContext,
java.lang.String text)
Write the specified text as the response to the writer associated with the body content for the tag within which we are currently nested. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String CHARACTERS_KEY
characters
instead
of a specific attribute.
protected static MessageBundleReference messages
Constructor Detail |
---|
protected TagUtils()
Method Detail |
---|
public static TagUtils getInstance()
public static void setInstance(TagUtils instance)
instance
- The instance to set.public java.util.List computeParameters(PageContext pageContext, java.lang.String paramId, java.lang.String paramName, java.lang.String paramScope, java.lang.String property, java.lang.String scope, boolean transaction) throws JspException
SourceBean
s;
every SourceBean
rappresent a query string param and is
composed of two attribute: name
and value
.
If no query parameters are identified, return an empty List
.
pageContext
- PageContext we are operating inparamId
- Single-value request parameter name (if any)paramName
- service context
data
containing single-value parameter valueparamScope
- Scope containing data named by paramName
property
- Property in service context
that identify
a collection of parameters.scope
- Scope containing data named by property
transaction
- Should we add our transaction control token?
SourceBean
rappresenting query parameters. An
empty List
if no query parameters are
found.
JspException
- if we cannot look up the required datapublic java.lang.String computeURL(PageContext pageContext, java.lang.String href, java.util.List params, java.lang.String anchor, boolean redirect) throws java.net.MalformedURLException, JspException
pageContext
- href
- params
- anchor
- redirect
-
java.net.MalformedURLException
JspException
computeURLWithCharEncoding(PageContext, String, List, String, boolean, boolean)
public java.lang.String computeURLWithCharEncoding(PageContext pageContext, java.lang.String href, java.util.List params, java.lang.String anchor, boolean redirect, boolean useLocalEncoding) throws java.net.MalformedURLException, JspException
href
parameter
that is not null. The returned URL will have already been passed to
response.encodeURL()
for adding a session identifier.
pageContext
- PageContext for the tag making this callhref
- URL to be utilized unmodified (if specified)params
- List of SourceBean
rappresenting
parameters to be dynamically included (if any)anchor
- Anchor to be dynamically included (if any)redirect
- Is this URL for a response.sendRedirect()
?
java.net.MalformedURLException
- if a URL cannot be created for
the specified parameters
JspException
public java.lang.String computeURL(PageContext pageContext, java.lang.String href, java.util.List params, java.lang.String anchor, boolean redirect, boolean encodeSeparator) throws java.net.MalformedURLException, JspException
pageContext
- href
- params
- anchor
- redirect
- encodeSeparator
-
java.net.MalformedURLException
JspException
computeURLWithCharEncoding(PageContext, String, List, String, boolean, boolean, boolean)
public java.lang.String computeURLWithCharEncoding(PageContext pageContext, java.lang.String href, java.util.List params, java.lang.String anchor, boolean redirect, boolean encodeSeparator, boolean useLocalSeparator) throws java.net.MalformedURLException, JspException
java.net.MalformedURLException
JspException
public java.lang.String computeURLWithCharEncoding(PageContext pageContext, java.lang.String href, java.util.List params, java.lang.String anchor, boolean redirect, java.lang.String alias, java.lang.String aliasRelative, boolean encodeSeparator, boolean useLocalEncoding) throws java.net.MalformedURLException, JspException
href
parameter
that is not null. The returned URL will have already been passed to
response.encodeURL()
for adding a session identifier.
pageContext
- PageContext for the tag making this callhref
- URL to be utilized unmodified (if specified)params
- List of SourceBean
rappresenting
parameters to be dynamically included (if any)anchor
- Anchor to be dynamically included (if any)redirect
- Is this URL for a response.sendRedirect()
?alias
- Logical name of a configured alias instead of th
href
parameter.aliasRelative
- String to append to the alias
attribute
if present.encodeSeparator
- This is only checked if redirect is set to
false (never encoded for a redirect). If true,
query string parameter separators are encoded
as >amp;, else & is used.useLocalEncoding
- If set to true, urlencoding is done on the
bytes of character encoding from
ServletResponse#getCharacterEncoding. Use UTF-8
otherwise.
java.net.MalformedURLException
- if a URL cannot be created for
the specified parameters
JspException
public java.lang.String encodeURL(java.lang.String url)
url
-
public java.lang.String encodeURL(java.lang.String url, java.lang.String enc)
enc
- The character encoding the urlencode is performed on.
public java.lang.String filter(java.lang.String value)
value
- The string to be filtered and returnedpublic java.lang.String getActionMappingName(java.lang.String action)
action
property is manipulated as follows in
computing the name of the requested mapping:
public boolean isXhtml(PageContext pageContext)
public java.lang.Object lookupProperty(PageContext pageContext, java.lang.String property, java.lang.String scopeName) throws JspException
JspException
public RequestContextIFace getRequestContext(PageContext pageContext)
public java.lang.Object lookupProperty(PageContext pageContext, java.lang.String property, java.lang.String scopeName, boolean emptyStringValue) throws JspException
JspException
public java.util.List lookupMultipleProperty(PageContext pageContext, java.lang.String property, java.lang.String scopeName) throws JspException
JspException
public java.util.List lookupMultipleProperty(PageContext pageContext, java.lang.String property, java.lang.String scopeName, java.lang.String paramName, java.lang.String paramValue, java.lang.String listAttribute) throws JspException
JspException
public java.lang.String message(java.lang.String bundle, java.lang.String key) throws JspException
bundle
- Name of the servlet context attribute for our
message resources bundlekey
- Message key to be looked up and returned
JspException
- if a lookup error occurs (will have been saved in
the request already)public java.lang.String message(java.lang.String bundle, java.util.Locale locale, java.lang.String key)
bundle
- locale
- key
-
public java.lang.String message(java.lang.String bundle, java.lang.String key, java.lang.Object[] args) throws JspException
bundle
- Name of the servlet context attribute for our
message resources bundlekey
- Message key to be looked up and returnedargs
- Replacement parameters for this message
JspException
- if a lookup error occurs (will have been saved in
the request already)public void saveException(PageContext pageContext, java.lang.Throwable exception)
pageContext
- The PageContext for the current pageexception
- The exception to be savedpublic void write(PageContext pageContext, java.lang.String text) throws JspException
doAfterBody()
method of a custom tag class that
implements BodyTag
, you should be calling
writePrevious()
instead.
pageContext
- The PageContext object for this pagetext
- The text to be written
JspException
- if an input/output error occurs (already saved)public void writePrevious(PageContext pageContext, java.lang.String text) throws JspException
pageContext
- The PageContext object for this pagetext
- The text to be written
JspException
- if an input/output error occurs (already saved)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |