Save This Page
Home » tapestry-src-5.0.19 » org.apache.tapestry5.services » [javadoc | source]
org.apache.tapestry5.services
public final class: TapestryModule [javadoc | source]
java.lang.Object
   org.apache.tapestry5.services.TapestryModule
The root module for Tapestry.
Constructor:
 public TapestryModule(PipelineBuilder pipelineBuilder,
    PropertyShadowBuilder shadowBuilder,
    RequestGlobals requestGlobals,
    ApplicationGlobals applicationGlobals,
    ChainBuilder chainBuilder,
    Environment environment,
    StrategyBuilder strategyBuilder,
    ComponentInstantiatorSource componentInstantiatorSource,
    PropertyAccess propertyAccess,
    Request request,
    Response response,
    ThreadLocale threadLocale,
    EnvironmentalShadowBuilder environmentalBuilder) 
    We inject all sorts of common dependencies (including builders) into the module itself (note: even though some of these service are defined by the module itself, that's ok because services are always lazy proxies). This isn't about efficiency (it may be slightly more efficient, but not in any noticable way), it's about eliminating the need to keep injecting these dependencies into invividual service builder and contribution methods.
Method from org.apache.tapestry5.services.TapestryModule Summary:
bind,   buildAjaxComponentEventRequestHandler,   buildAjaxComponentEventResultProcessor,   buildAlias,   buildApplicationInitializer,   buildClasspathAssetFactory,   buildClientPersistentFieldStrategy,   buildComponentClassFactory,   buildComponentClassResolver,   buildComponentClassTransformWorker,   buildComponentEventRequestHandler,   buildComponentEventResultProcessor,   buildContext,   buildContextAssetFactory,   buildDataTypeAnalyzer,   buildDefaultDataTypeAnalyzer,   buildEnvironment,   buildFormSupport,   buildHttpServletRequest,   buildHttpServletRequestHandler,   buildInjectionProvider,   buildMarkupRenderer,   buildMasterDispatcher,   buildMetaDataLocator,   buildObjectRenderer,   buildPageRenderRequestHandler,   buildPartialMarkupRenderer,   buildPropBindingFactory,   buildPropertyConduitSource,   buildRenderSupport,   buildRequest,   buildRequestHandler,   buildResponse,   buildServletApplicationInitializer,   buildSessionApplicationStatePersistenceStrategy,   buildTranslatorSource,   buildValidationMessagesSource,   buildValueEncoderSource,   contributeAjaxComponentEventResultProcessor,   contributeApplicationInitializer,   contributeApplicationStatePersistenceStrategySource,   contributeAssetProtectionDispatcher,   contributeAssetSource,   contributeBeanBlockSource,   contributeBindingSource,   contributeClasspathAssetAliasManager,   contributeComponentClassResolver,   contributeComponentClassTransformWorker,   contributeComponentEventRequestHandler,   contributeComponentEventResultProcessor,   contributeDataTypeAnalyzer,   contributeDefaultDataTypeAnalyzer,   contributeFactoryDefaults,   contributeFieldValidatorSource,   contributeHiddenFieldLocationRules,   contributeHttpServletRequestHandler,   contributeInjectionProvider,   contributeMarkupRenderer,   contributeMasterDispatcher,   contributeMasterObjectProvider,   contributeNullFieldStrategySource,   contributeObjectRenderer,   contributePageRenderRequestHandler,   contributePartialMarkupRenderer,   contributePersistentFieldManager,   contributePropBindingFactory,   contributeRegexAuthorizer,   contributeRequestHandler,   contributeResourceDigestGenerator,   contributeResourceStreamer,   contributeTemplateParser,   contributeTranslatorSource,   contributeTypeCoercer,   contributeValidationConstraintGenerator,   contributeValidationMessagesSource,   contributeValueEncoderSource
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.tapestry5.services.TapestryModule Detail:
 public static  void bind(ServiceBinder binder) 
 public ComponentEventRequestHandler buildAjaxComponentEventRequestHandler(List<ComponentEventRequestFilter> configuration,
    Logger logger,
    ServiceResources resources) 
 public ComponentEventResultProcessor buildAjaxComponentEventResultProcessor(Map<Class, ComponentEventResultProcessor> configuration) 
    The component event result processor used for Ajax-oriented component requests.
 public static Alias buildAlias(Logger logger,
    String mode,
    AliasManager overridesManager,
    Collection<AliasContribution> configuration) 
 public ApplicationInitializer buildApplicationInitializer(Logger logger,
    List<ApplicationInitializerFilter> configuration) 
 public AssetFactory buildClasspathAssetFactory(ResourceCache resourceCache,
    ClasspathAssetAliasManager aliasManager) 
 public PersistentFieldStrategy buildClientPersistentFieldStrategy(LinkFactory linkFactory,
    ServiceResources resources) 
 public ClassFactory buildComponentClassFactory() 
    Returns a org.apache.tapestry5.ioc.services.ClassFactory that can be used to create extra classes around component classes. This ClassFactory will be cleared whenever an underlying component class is discovered to have changed. Use of this class factory implies that your code will become aware of this (if necessary) to discard any cached object (alas, this currently involves dipping into the internals side to register for the correct notifications). Failure to properly clean up can result in really nasty PermGen space memory leaks.
 public ComponentClassResolver buildComponentClassResolver(ServiceResources resources) 
 public ComponentClassTransformWorker buildComponentClassTransformWorker(List<ComponentClassTransformWorker> configuration) 
    Allows the exact steps in the component class transformation process to be defined.
 public ComponentEventRequestHandler buildComponentEventRequestHandler(List<ComponentEventRequestFilter> configuration,
    Logger logger,
    ServiceResources resources) 
    Builds the component action request handler for traditional (non-Ajax) requests. These typically result in a redirect to a Tapestry render URL.
 public ComponentEventResultProcessor buildComponentEventResultProcessor(Map<Class, ComponentEventResultProcessor> configuration) 
    The component event result processor used for normal component requests.
 public Context buildContext(ApplicationGlobals globals) 
 public AssetFactory buildContextAssetFactory(ApplicationGlobals globals,
    RequestPathOptimizer optimizer) 
 public DataTypeAnalyzer buildDataTypeAnalyzer(List<DataTypeAnalyzer> configuration) 
    Analyzes properties to determine the data types, used to {@linkplain #contributeBeanBlockSource(org.apache.tapestry5.ioc.Configuration)} locale display and edit blocks} for properties. The default behaviors look for a org.apache.tapestry5.beaneditor.DataType annotation before deriving the data type from the property type.
 public DataTypeAnalyzer buildDefaultDataTypeAnalyzer(ServiceResources resources) 
    The default data type analyzer is the final analyzer consulted and identifies the type entirely pased on the property type, working against its own configuration (mapping property type class to data type).
 public Environment buildEnvironment(PerthreadManager perthreadManager) 
 public FormSupport buildFormSupport() 
 public HttpServletRequest buildHttpServletRequest() 
    Builds a shadow of the RequestGlobals.HTTPServletRequest property. Generally, you should inject the Request service instead, as future version of Tapestry may operate beyond just the servlet API.
 public HttpServletRequestHandler buildHttpServletRequestHandler(Logger logger,
    List<HttpServletRequestFilter> configuration,
    RequestHandler handler,
    String applicationCharset) 
 public InjectionProvider buildInjectionProvider(List<InjectionProvider> configuration) 
    A chain of command for providing values for Inject -ed fields in component classes. The service's configuration can be extended to allow for different automatic injections (based on some combination of field type and field name).
 public MarkupRenderer buildMarkupRenderer(PageRenderQueue pageRenderQueue,
    Logger logger,
    List<MarkupRendererFilter> configuration) 
 public Dispatcher buildMasterDispatcher(List<Dispatcher> configuration) 
    Ordered contributions to the MasterDispatcher service allow different URL matching strategies to occur.
 public MetaDataLocator buildMetaDataLocator(ServiceResources resources) 
 public ObjectRenderer buildObjectRenderer(Map<Class, ObjectRenderer> configuration) 
 public PageRenderRequestHandler buildPageRenderRequestHandler(List<PageRenderRequestFilter> configuration,
    Logger logger,
    ServiceResources resources) 
 public PartialMarkupRenderer buildPartialMarkupRenderer(Logger logger,
    List<PartialMarkupRendererFilter> configuration,
    PageRenderQueue renderQueue) 
 public BindingFactory buildPropBindingFactory(List<BindingFactory> configuration,
    PropertyConduitSource propertyConduitSource) 
    Builds the PropBindingFactory as a chain of command. The terminator of the chain is responsible for ordinary property names (and property paths). Contributions to the service cover additional special cases, such as simple literal values.
 public PropertyConduitSource buildPropertyConduitSource(ClassFactory componentClassFactory) 
 public RenderSupport buildRenderSupport() 
 public Request buildRequest() 
    Builds a shadow of the RequestGlobals.request property. Note again that the shadow can be an ordinary singleton, even though RequestGlobals is perthread.
 public RequestHandler buildRequestHandler(Logger logger,
    List<RequestFilter> configuration,
    Dispatcher masterDispatcher) 
 public Response buildResponse() 
    Builds a shadow of the RequestGlobals.response property. Note again that the shadow can be an ordinary singleton, even though RequestGlobals is perthread.
 public ServletApplicationInitializer buildServletApplicationInitializer(Logger logger,
    List<ServletApplicationInitializerFilter> configuration,
    ApplicationInitializer initializer) 
 public ApplicationStatePersistenceStrategy buildSessionApplicationStatePersistenceStrategy(ObjectLocator locator,
    EndOfRequestListenerHub hub) 
 public TranslatorSource buildTranslatorSource(ServiceResources resources) 
 public ValidationMessagesSource buildValidationMessagesSource(List<String> configuration,
    UpdateListenerHub updateListenerHub,
    AssetFactory classpathAssetFactory) 
    Builds the source of Messages containing validation messages. The contributions are paths to message bundles (resource paths within the classpath); the default contribution is "org/apache/tapestry5/internal/ValidationMessages".
 public ValueEncoderSource buildValueEncoderSource(Map<Class, ValueEncoderFactory> configuration) 
 public  void contributeAjaxComponentEventResultProcessor(MappedConfiguration<Class, ComponentEventResultProcessor> configuration,
    ObjectLocator locator) 
 public  void contributeApplicationInitializer(OrderedConfiguration<ApplicationInitializerFilter> configuration,
    TypeCoercer typeCoercer,
    ComponentClassResolver componentClassResolver) 
 public  void contributeApplicationStatePersistenceStrategySource(MappedConfiguration<String, ApplicationStatePersistenceStrategy> configuration,
    ApplicationStatePersistenceStrategy sessionStategy) 
    Contributes the default "session" strategy.
 public static  void contributeAssetProtectionDispatcher(AssetPathAuthorizer whitelist,
    AssetPathAuthorizer regex,
    OrderedConfiguration<AssetPathAuthorizer> conf) 
    Contributes the default set of AssetPathAuthorizers into the AssetProtectionDispatcher.
 public  void contributeAssetSource(MappedConfiguration<String, AssetFactory> configuration,
    AssetFactory contextAssetFactory,
    AssetFactory classpathAssetFactory) 
 public static  void contributeBeanBlockSource(Configuration<BeanBlockContribution> configuration) 
 public static  void contributeBindingSource(MappedConfiguration<String, BindingFactory> configuration,
    BindingFactory propBindingFactory,
    BindingFactory messageBindingFactory,
    BindingFactory validateBindingFactory,
    BindingFactory translateBindingFactory,
    BindingFactory assetBindingFactory,
    BindingFactory nullFieldStrategyBindingFactory) 
    Contributes the factory for serveral built-in binding prefixes ("asset", "block", "component", "literal", prop", "nullfieldstrategy", "message", "validate", "translate", "var").
 public static  void contributeClasspathAssetAliasManager(MappedConfiguration<String, String> configuration,
    String version,
    String scriptaculousPath,
    String datepickerPath) 
 public static  void contributeComponentClassResolver(Configuration<LibraryMapping> configuration) 
 public static  void contributeComponentClassTransformWorker(OrderedConfiguration<ComponentClassTransformWorker> configuration,
    ObjectLocator locator,
    InjectionProvider injectionProvider,
    ComponentClassResolver resolver) 
 public  void contributeComponentEventRequestHandler(OrderedConfiguration<ComponentEventRequestFilter> configuration,
    RequestSecurityManager requestSecurityManager,
    ComponentEventRequestHandler ajaxHandler,
    ObjectLocator locator) 
    Contributes filters:
    Ajax
    Determines if the request is Ajax oriented, and redirects to an alternative handler if so
    ImmediateRender
    When {@linkplain SymbolConstants#SUPPRESS_REDIRECT_FROM_ACTION_REQUESTS immediate action response rendering} is enabled, generates the markup response (instead of a page redirect response, which is the normal behavior)
    Secure
    Sends a redirect if an non-secure request accesses a secure page
 public  void contributeComponentEventResultProcessor(ComponentEventResultProcessor componentInstanceProcessor,
    ObjectLocator locator,
    MappedConfiguration<Class, ComponentEventResultProcessor> configuration) 
    Contributes handlers for the following types:
    Object
    Failure case, added to provide a more useful exception message
    Link
    Sends a redirect to the link (which is typically a page render link)
    String
    Sends a page render redirect
    Class
    Interpreted as the class name of a page, sends a page render render redirect (this is more refactoring safe than the page name)
    Component
    A page's root component (though a non-root component will work, but will generate a warning). A direct to the containing page is sent.
    org.apache.tapestry5.StreamResponse
    The stream response is sent as the actual reply.
    URL
    Sends a redirect to a (presumably) external URL
 public static  void contributeDataTypeAnalyzer(OrderedConfiguration<DataTypeAnalyzer> configuration,
    DataTypeAnalyzer defaultDataTypeAnalyzer) 
 public static  void contributeDefaultDataTypeAnalyzer(MappedConfiguration<Class, String> configuration) 
    Maps property types to data type names:
    • String --> text
    • Number --> number
    • Enum --> enum
    • Boolean --> boolean
    • Date --> date
 public static  void contributeFactoryDefaults(MappedConfiguration<String, String> configuration) 
    Contributes factory defaults that map be overridden.
 public static  void contributeFieldValidatorSource(MappedConfiguration<String, Validator> configuration) 
    Contributes the basic set of validators:
    • required
    • minlength
    • maxlength
    • min
    • max
    • regexp
 public static  void contributeHiddenFieldLocationRules(MappedConfiguration<String, RelativeElementPosition> configuration) 
    Determines positioning of hidden fields relative to other elements (this is needed by org.apache.tapestry5.corelib.components.FormFragment and others.

    For elements input, select, textarea and label the hidden field is positioned after.

    For elements p, div, li and td, the hidden field is positioned inside.

 public static  void contributeHttpServletRequestHandler(OrderedConfiguration<HttpServletRequestFilter> configuration,
    HttpServletRequestFilter ignoredPathsFilter) 
 public static  void contributeInjectionProvider(OrderedConfiguration<InjectionProvider> configuration,
    MasterObjectProvider masterObjectProvider,
    ObjectLocator locator,
    SymbolSource symbolSource,
    AssetSource assetSource) 
    Contributes the base set of injection providers:
    Default
    based on MasterObjectProvider
    Block
    injects fields of type Block
    ComponentResources
    give component access to its resources
    CommonResources
    access to properties of resources (log, messages, etc.)
    Asset
    injection of assets (triggered via Path annotation), with the path relative to the component class
    Service
    ordered last, for use when Inject is present and nothing else works, matches field type against Tapestry IoC services
 public  void contributeMarkupRenderer(OrderedConfiguration<MarkupRendererFilter> configuration,
    boolean productionMode,
    boolean scriptsAtTop,
    Asset stylesheetAsset,
    Asset spacerImage,
    ValidationMessagesSource validationMessagesSource,
    SymbolSource symbolSource,
    AssetSource assetSource) 
 public  void contributeMasterDispatcher(OrderedConfiguration<Dispatcher> configuration,
    Dispatcher assetProt,
    ObjectLocator locator) 
 public static  void contributeMasterObjectProvider(OrderedConfiguration<ObjectProvider> configuration,
    Alias alias,
    ObjectProvider assetObjectProvider) 
    Contributes two object providers:
    Alias
    Searches by type among {@linkplain AliasContribution contributions} to the Alias service
    Asset
    Checks for the Path annotation, and injects an Asset
    Service
    Injects based on the Service annotation, if present
 public static  void contributeNullFieldStrategySource(MappedConfiguration<String, NullFieldStrategy> configuration) 
    Contributes strategies accessible via the NullFieldStrategySource service.

    default
    Does nothing, nulls stay null.
    zero
    Null values are converted to zero.
 public  void contributeObjectRenderer(MappedConfiguration<Class, ObjectRenderer> configuration,
    ObjectRenderer locationRenderer,
    TypeCoercer typeCoercer,
    ObjectLocator locator) 
 public  void contributePageRenderRequestHandler(OrderedConfiguration<PageRenderRequestFilter> configuration,
    RequestSecurityManager securityManager) 
    Contributes a single filter, "Secure", which checks for non-secure requests that access secure pages.
 public  void contributePartialMarkupRenderer(OrderedConfiguration<PartialMarkupRendererFilter> configuration,
    Asset spacerImage,
    SymbolSource symbolSource,
    AssetSource assetSource,
    ValidationMessagesSource validationMessagesSource) 
 public  void contributePersistentFieldManager(MappedConfiguration<String, PersistentFieldStrategy> configuration,
    Request request,
    PersistentFieldStrategy clientStrategy) 
    Contributes several strategies:
    session
    Values are stored in the Session
    flash
    Values are stored in the Session , until the next request (for the page)
    client
    Values are encoded into URLs (or hidden form fields)
 public  void contributePropBindingFactory(OrderedConfiguration<BindingFactory> configuration) 
 public  void contributeRegexAuthorizer(Configuration<String> regex,
    String scriptPath,
    String datepickerPath) 
 public  void contributeRequestHandler(OrderedConfiguration<RequestFilter> configuration,
    Context context,
    long checkInterval,
    long updateTimeout,
    UpdateListenerHub updateListenerHub,
    LocalizationSetter localizationSetter,
    EndOfRequestListenerHub endOfRequestListenerHub,
    ObjectLocator locator) 
    Continues a number of filters into the RequestHandler service:
    StaticFiles
    Checks to see if the request is for an actual file, if so, returns true to let the servlet container process the request
    CheckForUpdates
    Periodically fires events that checks to see if the file system sources for any cached data has changed (see org.apache.tapestry5.internal.services.CheckForUpdatesFilter ).
    ErrorFilter
    Catches request errors and lets the org.apache.tapestry5.services.RequestExceptionHandler handle them
    Localization
    Determines the locale for the current request from header data or cookies in the request
    StoreIntoGlobals
    Stores the request and response into the org.apache.tapestry5.services.RequestGlobals service (this is repeated at the end of the pipeline, in case any filter substitutes the request or response).
 public static  void contributeResourceDigestGenerator(Configuration<String> configuration) 
    Configures the extensions that will require a digest to be downloaded via the asset dispatcher. Most resources are "safe", they don't require a digest. For unsafe resources, the digest is incorporated into the URL to ensure that the client side isn't just "fishing".

    The extensions must be all lower case.

    This contributes "class" and "tml" (the template extension).

 public  void contributeResourceStreamer(MappedConfiguration<String, String> configuration) 
    Adds content types for "css" and "js" file extensions.
    css
    test/css
    js
    text/javascript
 public static  void contributeTemplateParser(MappedConfiguration<String, URL> config) 
 public static  void contributeTranslatorSource(Configuration<Translator> configuration) 
    Contributes the basic set of named translators:
    • string
    • byte
    • integer
    • long
    • float
    • double
    • short
 public static  void contributeTypeCoercer(Configuration<CoercionTuple> configuration) 
 public static  void contributeValidationConstraintGenerator(OrderedConfiguration<ValidationConstraintGenerator> configuration) 
    Adds built-in constraint generators:
    • PrimtiveField -- primitive fields are always required
    • ValidateAnnotation -- adds constraints from a Validate annotation
 public  void contributeValidationMessagesSource(OrderedConfiguration<String> configuration) 
    Contributes org/apache/tapestry5/internal/ValidationMessages as "Default", ordered first.
 public static  void contributeValueEncoderSource(MappedConfiguration<Class, ValueEncoderFactory> configuration,
    ObjectLocator locator)