|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.tapestry.Tapestry
public final class Tapestry
A placeholder for a number of (static) methods that don't belong elsewhere, as well as a global location for static constants.
Field Summary | |
---|---|
static String |
ABSTRACTPAGE_DETACH_METHOD_ID
Method id used to check that IPage.detach() is invoked. |
static String |
ABSTRACTPAGE_VALIDATE_METHOD_ID
Method id used to check that IPage.validate(IRequestCycle)
is invoked. |
static String |
ACTION_SERVICE
The name ("action") of a service that allows behavior to be associated with an IAction component, such as ActionLink or
Form . |
static String |
ASSET_SERVICE
The name ("asset") of a service used to access internal assets. |
static String |
DEFAULT_TEMPLATE_EXTENSION
The default extension for templates, "html". |
static String |
DIRECT_SERVICE
The name ("direct") of a service that allows stateless behavior for an DirectLink component. |
static String |
EXTERNAL_SERVICE
The name ("external") of a service that a allows IExternalPage to be selected. |
static String |
HOME_SERVICE
The name ("home") of a service that jumps to the home page. |
static String |
LINK_COMPONENT_ATTRIBUTE_NAME
The name of an IRequestCycle attribute in which the
currently rendering ILinkComponent
is stored. |
static String |
MONITOR_FACTORY_EXTENSION_NAME
Name of an application extension used as a factory for IMonitor instances. |
static String |
MULTIPART_DECODER_EXTENSION_NAME
Name of optional application extension for the multipart decoder used by the application. |
static String |
OGNL_TYPE_CONVERTER
Class name of an TypeConverter implementing class
to use as a type converter for ExpressionBinding |
static String |
PAGE_SERVICE
The name ("page") of a service that allows a new page to be selected. |
static String |
PARAMETER_PROPERTY_NAME_SUFFIX
Suffix appended to a parameter name to form the name of a property that stores the binding for the parameter. |
static String |
PARAMETERS_QUERY_PARAMETER_NAME
The query parameter for application specific parameters to the service (this is used with the direct service). |
static String |
REQUEST_DECODER_EXTENSION_NAME
Key used to obtain an extension from the application specification. |
static String |
RESET_SERVICE
The name ("reset") of a service used to clear cached template and specification data and remove all pooled pages. |
static String |
RESTART_SERVICE
The name ("restart") of a service that invalidates the session and restarts the application. |
static String |
SERVICE_QUERY_PARAMETER_NAME
Query parameter that identfies the service for the request. |
static String |
SIMPLE_PROPERTY_NAME_PATTERN
Regular expression defining a simple property name. |
static String |
SPECIFICATION_RESOLVER_DELEGATE_EXTENSION_NAME
Name of application extension used to resolve page and component specifications that can't be located by the normal means. |
static String |
TAG_SUPPORT_PARAMETERS_ATTRIBUTE
Name of a request attribute used with the TAGSUPPORT_SERVICE service. |
static String |
TAG_SUPPORT_SERVICE_ATTRIBUTE
Name of a request attribute used with the TAGSUPPORT_SERVICE service. |
static String |
TAG_SUPPORT_SERVLET_PATH_ATTRIBUTE
Name of a request attribute used with the TAGSUPPORT_SERVICE service. |
static String |
TAGSUPPORT_SERVICE
Service used to support rendering of JSP tags. |
static String |
TEMPLATE_EXTENSION_PROPERTY
Property name used to get the extension used for templates. |
static String |
TEMPLATE_SOURCE_DELEGATE_EXTENSION_NAME
Name of application extension used to resolve page and component templates that can't be located by the normal means. |
static String |
VERSION
The version of the framework; this is updated for major releases. |
Method Summary | |
---|---|
static void |
addMethodInvocation(Object methodId)
Adds a method invocation to the list of invocations. |
static void |
checkMethodInvocation(Object methodId,
String methodName,
Object object)
Checks to see if a particular method has been invoked. |
static void |
clearMethodInvocations()
Clears the list of method invocations. |
static void |
close(InputStream stream)
Closes the stream (if not null), ignoring any IOException thrown. |
static Iterator |
coerceToIterator(Object value)
Converts an Object into an Iterator , following some basic rules. |
static Map |
convertArrayToMap(Object[] array)
Converts an even-sized array of objects back into a Map . |
static Object[] |
convertMapToArray(Map map)
Converts a Map to an even-sized array of key/value
pairs. |
static void |
copyInformalBindings(IComponent source,
IComponent destination)
Copys all informal bindings from a source component
to the destination component. |
static ApplicationRuntimeException |
createNoSuchComponentException(IComponent component,
String id,
ILocation location)
|
static BindingException |
createNullBindingException(IBinding binding)
Creates an exception indicating the binding value is null. |
static ApplicationRuntimeException |
createRenderOnlyPropertyException(IComponent component,
String propertyName)
|
static BindingException |
createRequiredParameterException(IComponent component,
String parameterName)
|
static boolean |
evaluateBoolean(Object value)
Evaluates an object to determine its boolean value. |
static ILocation |
findLocation(Object[] locations)
Selects the first ILocation in an array of objects. |
static void |
fireObservedChange(IComponent component,
String propertyName,
boolean newValue)
Method used by pages and components to send notifications about property changes. |
static void |
fireObservedChange(IComponent component,
String propertyName,
byte newValue)
Method used by pages and components to send notifications about property changes. |
static void |
fireObservedChange(IComponent component,
String propertyName,
char newValue)
Method used by pages and components to send notifications about property changes. |
static void |
fireObservedChange(IComponent component,
String propertyName,
double newValue)
Method used by pages and components to send notifications about property changes. |
static void |
fireObservedChange(IComponent component,
String propertyName,
float newValue)
Method used by pages and components to send notifications about property changes. |
static void |
fireObservedChange(IComponent component,
String propertyName,
int newValue)
Method used by pages and components to send notifications about property changes. |
static void |
fireObservedChange(IComponent component,
String propertyName,
long newValue)
Method used by pages and components to send notifications about property changes. |
static void |
fireObservedChange(IComponent component,
String propertyName,
Object newValue)
Method used by pages and components to send notifications about property changes. |
static void |
fireObservedChange(IComponent component,
String propertyName,
short newValue)
Method used by pages and components to send notifications about property changes. |
static String |
format(String key,
Object arg)
Convienience method for invoking format(String, Object[]) . |
static String |
format(String key,
Object[] args)
Gets a string from the TapestryStrings resource bundle. |
static String |
format(String key,
Object arg1,
Object arg2)
Convienience method for invoking format(String, Object[]) . |
static String |
format(String key,
Object arg1,
Object arg2,
Object arg3)
Convienience method for invoking format(String, Object[]) . |
static IResourceLocation |
getApplicationRootLocation(IRequestCycle cycle)
Returns the application root location, which is in the ServletContext , based on
the servlet path . |
static String |
getClassName(Class subject)
Given a Class, creates a presentable name for the class, even if the class is a scalar type or Array type. |
static Locale |
getLocale(String s)
Gets the Locale for the given string, which is the result
of Locale.toString() . |
static String |
getMessage(String key)
Convienience method for invoking format(String, Object[]) . |
static boolean |
isBlank(String input)
Returns true if the input is null or contains only whitespace. |
static boolean |
isEmpty(Collection c)
Returns true if the Collection is null or empty. |
static boolean |
isEmpty(Map map)
Returns true if the Map is null or empty. |
static boolean |
isNonBlank(String input)
Returns true if the input is not null and not empty (or only whitespace). |
static int |
size(Collection c)
Returns the size of a collection, or zero if the collection is null. |
static int |
size(Object[] array)
Returns the length of the array, or 0 if the array is null. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String TAG_SUPPORT_SERVICE_ATTRIBUTE
TAGSUPPORT_SERVICE
service. The attribute
defines the underlying service to for which a URL will be generated.
public static final String TAG_SUPPORT_SERVLET_PATH_ATTRIBUTE
TAGSUPPORT_SERVICE
service. The attribute
defines the correct servlet path for the
Tapestry application (which, for the odd-man-out TAGSUPPORT_SERVICE
may not match HttpServletRequest.getServletPath() because of
the use of an include.
public static final String TAG_SUPPORT_PARAMETERS_ATTRIBUTE
TAGSUPPORT_SERVICE
service. The attribute
defines an array of objects to be converted into
service parameters (i.e., for use with the
EXTERNAL_SERVICE
).
public static final String TAGSUPPORT_SERVICE
public static final String ACTION_SERVICE
IAction
component, such as ActionLink
or
Form
.
This service is used with actions that are tied to the dynamic state of the page, and which require a rewind of the page.
public static final String DIRECT_SERVICE
DirectLink
component.
This service rolls back the state of the page but doesn't rewind the the dynamic state of the page the was the action service does, which is more efficient but less powerful.
An array of String parameters may be included with the
service URL; these will be made available to the DirectLink
component's listener.
public static final String EXTERNAL_SERVICE
IExternalPage
to be selected.
Associated with a ExternalLink
component.
This service enables IExternalPage
s to be accessed via a URL.
External pages may be booked marked using their URL for future reference.
An array of Object parameters may be included with the
service URL; these will be passed to the
IExternalPage.activateExternalPage(Object[], IRequestCycle)
method.
public static final String PAGE_SERVICE
PageLink
component.
The service requires a single parameter: the name of the target page.
public static final String HOME_SERVICE
public static final String RESTART_SERVICE
public static final String ASSET_SERVICE
public static final String RESET_SERVICE
This service is only available if the Java system property
org.apache.tapestry.enable-reset-service
is set to true
.
public static final String SERVICE_QUERY_PARAMETER_NAME
public static final String PARAMETERS_QUERY_PARAMETER_NAME
URLEncoder.encode(String)
before
being added to the URL. Multiple values are handle by repeatedly
establishing key/value pairs (this is a change from behavior in
2.1 and earlier).
public static final String TEMPLATE_EXTENSION_PROPERTY
public static final String DEFAULT_TEMPLATE_EXTENSION
public static final String LINK_COMPONENT_ATTRIBUTE_NAME
IRequestCycle
attribute in which the
currently rendering ILinkComponent
is stored. Link components do not nest.
public static final String PARAMETER_PROPERTY_NAME_SUFFIX
public static final String SPECIFICATION_RESOLVER_DELEGATE_EXTENSION_NAME
ISpecificationResolverDelegate
.
public static final String TEMPLATE_SOURCE_DELEGATE_EXTENSION_NAME
ITemplateSourceDelegate
.
public static final String REQUEST_DECODER_EXTENSION_NAME
IRequestDecoder
.
public static final String MULTIPART_DECODER_EXTENSION_NAME
IMultipartDecoder
(and is generally a configured instance of
DefaultMultipartDecoder
).
public static final String ABSTRACTPAGE_VALIDATE_METHOD_ID
IPage.validate(IRequestCycle)
is invoked.
checkMethodInvocation(Object, String, Object)
,
Constant Field Valuespublic static final String ABSTRACTPAGE_DETACH_METHOD_ID
IPage.detach()
is invoked.
checkMethodInvocation(Object, String, Object)
,
Constant Field Valuespublic static final String SIMPLE_PROPERTY_NAME_PATTERN
public static final String MONITOR_FACTORY_EXTENSION_NAME
IMonitor
instances. The extension
must implement IMonitorFactory
.
public static final String OGNL_TYPE_CONVERTER
TypeConverter
implementing class
to use as a type converter for ExpressionBinding
public static final String VERSION
Method Detail |
---|
public static void copyInformalBindings(IComponent source, IComponent destination)
bindings
from a source component
to the destination component. Informal bindings are bindings for
informal parameters. This will overwrite parameters (formal or
informal) in the
destination component if there is a naming conflict.
public static boolean evaluateBoolean(Object value)
Class | Test |
---|---|
Boolean |
Self explanatory. |
Number |
True if non-zero, false otherwise. |
Collection |
True if contains any elements (non-zero size), false otherwise. |
String |
True if contains any non-whitespace characters, false otherwise. |
Any Object array type | True if contains any elements (non-zero length), false otherwise. |
Any other non-null object evaluates to true.
public static Iterator coerceToIterator(Object value)
Iterator
, following some basic rules.
Input Class | Result |
---|---|
array | Converted to a List and iterator returned.
null returned if the array is empty. This works with both object arrays and
arrays of scalars. |
Iterator | Returned as-is. |
Collection | Iterator returned, or null if the Collection is empty |
Any other | Iterator for singleton collection returned |
null | null returned |
public static Locale getLocale(String s)
Locale
for the given string, which is the result
of Locale.toString()
. If no such locale is already registered,
a new instance is created, registered and returned.
public static void close(InputStream stream)
IOException
thrown.
public static String format(String key, Object[] args)
MessageFormat.format(java.lang.String, java.lang.Object[])
.
public static String getMessage(String key)
format(String, Object[])
.
public static String format(String key, Object arg)
format(String, Object[])
.
public static String format(String key, Object arg1, Object arg2)
format(String, Object[])
.
public static String format(String key, Object arg1, Object arg2, Object arg3)
format(String, Object[])
.
public static int size(Collection c)
public static int size(Object[] array)
public static boolean isEmpty(Map map)
public static boolean isEmpty(Collection c)
public static Object[] convertMapToArray(Map map)
Map
to an even-sized array of key/value
pairs. This may be useful when using a Map as service parameters
(with DirectLink
. Assuming the keys
and values are simple objects (String, Boolean, Integer, etc.), then
the representation as an array will encode more efficiently
(via DataSqueezer
than
serializing the Map and its contents.
public static Map convertArrayToMap(Object[] array)
Map
.
convertMapToArray(Map)
public static IResourceLocation getApplicationRootLocation(IRequestCycle cycle)
ServletContext
, based on
the servlet path
.
public static String getClassName(Class subject)
public static ILocation findLocation(Object[] locations)
ILocation
in an array of objects.
Skips over nulls. The objects may be instances of
{Location or ILocatable
. May return null
if no Location found found.
public static BindingException createNullBindingException(IBinding binding)
public static ApplicationRuntimeException createNoSuchComponentException(IComponent component, String id, ILocation location)
public static BindingException createRequiredParameterException(IComponent component, String parameterName)
public static ApplicationRuntimeException createRenderOnlyPropertyException(IComponent component, String propertyName)
public static void clearMethodInvocations()
checkMethodInvocation(Object, String, Object)
public static void addMethodInvocation(Object methodId)
checkMethodInvocation(Object, String, Object)
public static void checkMethodInvocation(Object methodId, String methodName, Object object)
The caller should invoke clearMethodInvocations()
, then invoke a method on
the object. The super-class implementation should invoke addMethodInvocation(Object)
to indicate that it was, in fact, invoked. The caller then invokes
this method to vlaidate that the super-class implementation was invoked.
The list of method invocations is stored in a ThreadLocal
variable.
public static void fireObservedChange(IComponent component, String propertyName, Object newValue)
component
- the component containing the propertypropertyName
- the name of the property which changednewValue
- the new value for the propertypublic static void fireObservedChange(IComponent component, String propertyName, boolean newValue)
component
- the component containing the propertypropertyName
- the name of the property which changednewValue
- the new value for the propertypublic static void fireObservedChange(IComponent component, String propertyName, double newValue)
component
- the component containing the propertypropertyName
- the name of the property which changednewValue
- the new value for the propertypublic static void fireObservedChange(IComponent component, String propertyName, float newValue)
component
- the component containing the propertypropertyName
- the name of the property which changednewValue
- the new value for the propertypublic static void fireObservedChange(IComponent component, String propertyName, int newValue)
component
- the component containing the propertypropertyName
- the name of the property which changednewValue
- the new value for the propertypublic static void fireObservedChange(IComponent component, String propertyName, long newValue)
component
- the component containing the propertypropertyName
- the name of the property which changednewValue
- the new value for the propertypublic static void fireObservedChange(IComponent component, String propertyName, char newValue)
component
- the component containing the propertypropertyName
- the name of the property which changednewValue
- the new value for the propertypublic static void fireObservedChange(IComponent component, String propertyName, byte newValue)
component
- the component containing the propertypropertyName
- the name of the property which changednewValue
- the new value for the propertypublic static void fireObservedChange(IComponent component, String propertyName, short newValue)
component
- the component containing the propertypropertyName
- the name of the property which changednewValue
- the new value for the propertypublic static boolean isBlank(String input)
Note: Yes, you'd think we'd use StringUtils
, but with
the change in names and behavior between releases, it is smarter
to just implement our own little method!
public static boolean isNonBlank(String input)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |