Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
   // Copyright 2006, 2007, 2008, 2009, 2010 The Apache Software Foundation
   //
   // Licensed under the Apache License, Version 2.0 (the "License");
   // you may not use this file except in compliance with the License.
   // You may obtain a copy of the License at
   //
   // http://www.apache.org/licenses/LICENSE-2.0
   //
   // Unless required by applicable law or agreed to in writing, software
  // distributed under the License is distributed on an "AS IS" BASIS,
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  // See the License for the specific language governing permissions and
  // limitations under the License.
  
  package org.apache.tapestry5.services;
  
  import java.net.URL;
  import java.util.Date;
  import java.util.List;
  import java.util.Locale;
  import java.util.Map;
  import java.util.Random;
  import java.util.Set;
  
  
The root module for Tapestry.
 
 { "JavaDoc" })
 @Marker(Core.class)
 public final class TapestryModule
 {
     private final PipelineBuilder pipelineBuilder;
 
     private final ApplicationGlobals applicationGlobals;
 
     private final PropertyShadowBuilder shadowBuilder;
 
     private final Environment environment;
 
     private final StrategyBuilder strategyBuilder;
 
     private final PropertyAccess propertyAccess;
 
     private final ChainBuilder chainBuilder;
 
     private final Request request;
 
     private final Response response;
 
     private final RequestGlobals requestGlobals;
 
 
     private final EndOfRequestEventHub endOfRequestEventHub;

    
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 individual service builder and contribution methods.
 
     public TapestryModule(PipelineBuilder pipelineBuilder,
 
     PropertyShadowBuilder shadowBuilder,
 
     RequestGlobals requestGlobals,
 
     ApplicationGlobals applicationGlobals,
 
     ChainBuilder chainBuilder,
 
     Environment environment,
 
     StrategyBuilder strategyBuilder,
 
     PropertyAccess propertyAccess,
 
     Request request,
 
     Response response,
 
     EnvironmentalShadowBuilder environmentalBuilder,
 
     EndOfRequestEventHub endOfRequestEventHub)
     {
         this. = pipelineBuilder;
         this. = shadowBuilder;
         this. = requestGlobals;
         this. = applicationGlobals;
         this. = chainBuilder;
         this. = environment;
         this. = strategyBuilder;
         this. = propertyAccess;
         this. = request;
         this. = response;
         this. = environmentalBuilder;
         this. = endOfRequestEventHub;
     }
 
     // A bunch of classes "promoted" from inline inner class to nested classes,
     // just so that the stack trace would be more readable. Most of these
     // are teminators for pipeline services.
 
    

Since:
5.1.0.0
 
     private class ApplicationInitializerTerminator implements ApplicationInitializer
     {
         public void initializeApplication(Context context)
         {
             .storeContext(context);
         }
     }

    

Since:
5.1.0.0
 
     {
         private final RequestHandler handler;
         private final String applicationCharset;
         private final SessionPersistedObjectAnalyzer analyzer;
 
         public HttpServletRequestHandlerTerminator(RequestHandler handlerString applicationCharset,
                 SessionPersistedObjectAnalyzer analyzer)
         {
             this. = handler;
             this. = applicationCharset;
             this. = analyzer;
         }
 
         public boolean service(HttpServletRequest servletRequestHttpServletResponse servletResponse)
                 throws IOException
         {
             .storeServletRequestResponse(servletRequestservletResponse);
 
             Request request = new RequestImpl(servletRequest);
             Response response = new ResponseImpl(servletRequestservletResponse);
 
             // TAP5-257: Make sure that the "initial guess" for request/response
             // is available, even if
             // some filter in the RequestHandler pipeline replaces them.
 
             .storeRequestResponse(requestresponse);
 
             // Transition from the Servlet API-based pipeline, to the
             // Tapestry-based pipeline.
 
             return .service(requestresponse);
         }
     }

    

Since:
5.1.0.0
 
     {
         private final ApplicationInitializer initializer;
 
         {
             this. = initializer;
         }
 
         public void initializeApplication(ServletContext servletContext)
         {
             .storeServletContext(servletContext);
 
             // And now, down the (Web) ApplicationInitializer pipeline ...
 
             ContextImpl context = new ContextImpl(servletContext);
 
             .storeContext(context);
 
             .initializeApplication(context);
         }
     }

    

Since:
5.1.0.0
 
     private class RequestHandlerTerminator implements RequestHandler
     {
         private final Dispatcher masterDispatcher;
 
         public RequestHandlerTerminator(Dispatcher masterDispatcher)
         {
             this. = masterDispatcher;
         }
 
         public boolean service(Request requestResponse responsethrows IOException
         {
             // Update RequestGlobals with the current request/response (in case
             // some filter replaced the
             // normal set).
             .storeRequestResponse(requestresponse);
 
             return .dispatch(requestresponse);
         }
     }
 
     public static void bind(ServiceBinder binder)
     {
         binder.bind(ClasspathAssetAliasManager.classClasspathAssetAliasManagerImpl.class);
         binder.bind(PersistentLocale.classPersistentLocaleImpl.class);
         binder.bind(ApplicationStateManager.classApplicationStateManagerImpl.class);
         binder.bind(ApplicationStatePersistenceStrategySource.class,
                 ApplicationStatePersistenceStrategySourceImpl.class);
         binder.bind(BindingSource.classBindingSourceImpl.class);
         binder.bind(FieldValidatorSource.classFieldValidatorSourceImpl.class);
         binder.bind(ApplicationGlobals.classApplicationGlobalsImpl.class);
         binder.bind(AssetSource.classAssetSourceImpl.class);
         binder.bind(Cookies.classCookiesImpl.class);
         binder.bind(RequestGlobals.classRequestGlobalsImpl.class);
         binder.bind(ResourceDigestGenerator.classResourceDigestGeneratorImpl.class);
         binder.bind(EnvironmentalShadowBuilder.classEnvironmentalShadowBuilderImpl.class);
         binder.bind(ComponentSource.classComponentSourceImpl.class);
         binder.bind(BeanModelSource.classBeanModelSourceImpl.class);
         binder.bind(BeanBlockSource.classBeanBlockSourceImpl.class);
         binder.bind(ComponentDefaultProvider.classComponentDefaultProviderImpl.class);
         binder.bind(MarkupWriterFactory.classMarkupWriterFactoryImpl.class);
         binder.bind(FieldValidationSupport.classFieldValidationSupportImpl.class);
         binder.bind(ObjectRenderer.classLocationRenderer.class).withId("LocationRenderer");
         binder.bind(ObjectProvider.classAssetObjectProvider.class).withId("AssetObjectProvider");
         binder.bind(RequestExceptionHandler.classDefaultRequestExceptionHandler.class);
                 "ComponentInstanceResultProcessor");
         binder.bind(NullFieldStrategySource.classNullFieldStrategySourceImpl.class);
         binder.bind(HttpServletRequestFilter.classIgnoredPathsFilter.class).withId("IgnoredPathsFilter");
         binder.bind(ContextValueEncoder.classContextValueEncoderImpl.class);
         binder.bind(BaseURLSource.classBaseURLSourceImpl.class);
         binder.bind(BeanBlockOverrideSource.classBeanBlockOverrideSourceImpl.class);
         binder.bind(AliasManager.classAliasManagerImpl.class).withId("AliasOverrides");
         binder.bind(HiddenFieldLocationRules.classHiddenFieldLocationRulesImpl.class);
         binder.bind(PageDocumentGenerator.classPageDocumentGeneratorImpl.class);
         binder.bind(ResponseRenderer.classResponseRendererImpl.class);
         binder.bind(FieldTranslatorSource.classFieldTranslatorSourceImpl.class);
         binder.bind(BindingFactory.classMessageBindingFactory.class).withId("MessageBindingFactory");
         binder.bind(BindingFactory.classValidateBindingFactory.class).withId("ValidateBindingFactory");
         binder.bind(BindingFactory.classTranslateBindingFactory.class).withId("TranslateBindingFactory");
         binder.bind(BindingFactory.classAssetBindingFactory.class).withId("AssetBindingFactory");
         binder.bind(BindingFactory.classContextBindingFactory.class).withId("ContextBindingFactory");
         binder.bind(BindingFactory.classNullFieldStrategyBindingFactory.class).withId(
                 "NullFieldStrategyBindingFactory");
         binder.bind(BindingFactory.classSymbolBindingFactory.class).withId("SymbolBindingFactory");
         binder.bind(URLEncoder.classURLEncoderImpl.class);
         binder.bind(ContextPathEncoder.classContextPathEncoderImpl.class);
                 .withId("SessionApplicationStatePersistenceStrategy");
         binder.bind(AssetPathConverter.classIdentityAssetPathConverter.class);
         binder.bind(NumericTranslatorSupport.class);
         binder.bind(ClientDataEncoder.classClientDataEncoderImpl.class);
         binder.bind(ComponentEventLinkEncoder.classComponentEventLinkEncoderImpl.class);
         binder.bind(PageRenderLinkSource.classPageRenderLinkSourceImpl.class);
         binder.bind(ClientInfrastructure.classClientInfrastructureImpl.class);
         binder.bind(URLRewriter.classURLRewriterImpl.class);
         binder.bind(ValidatorMacro.classValidatorMacroImpl.class);
         binder.bind(PropertiesFileParser.classPropertiesFileParserImpl.class);
         binder.bind(PageActivator.classPageActivatorImpl.class);
         binder.bind(Dispatcher.classAssetDispatcher.class).withId("AssetDispatcher");
         binder.bind(AssetPathConstructor.classAssetPathConstructorImpl.class);
         binder.bind(JavaScriptStackSource.classJavaScriptStackSourceImpl.class);
         binder.bind(TranslatorAlternatesSource.classTranslatorAlternatesSourceImpl.class);
         binder.bind(MetaWorker.classMetaWorkerImpl.class);
         binder.bind(LinkTransformer.classLinkTransformerImpl.class);
         binder.bind(SelectModelFactory.classSelectModelFactoryImpl.class);
     }
 
     // ========================================================================
     //
     // Service Builder Methods (static)
     //
     // ========================================================================
 
     public static Alias buildAlias(Logger logger,
 
     String mode,
 
     @InjectService("AliasOverrides")
     AliasManager overridesManager,
 
     Collection<AliasContributionconfiguration)
     {
         AliasManager manager = new AliasManagerImpl(loggerconfiguration);
 
         return new AliasImpl(managermodeoverridesManager);
     }
 
     // ========================================================================
     //
     // Service Contribution Methods (static)
     //
     // ========================================================================
 
    
Contributes the factory for serveral built-in binding prefixes ("asset", "block", "component", "literal", prop", "nullfieldstrategy", "message", "validate", "translate", "var").
 
     public static void contributeBindingSource(MappedConfiguration<StringBindingFactoryconfiguration,
 
     @InjectService("PropBindingFactory")
     BindingFactory propBindingFactory,
 
     @InjectService("MessageBindingFactory")
     BindingFactory messageBindingFactory,
 
     @InjectService("ValidateBindingFactory")
     BindingFactory validateBindingFactory,
 
     @InjectService("TranslateBindingFactory")
     BindingFactory translateBindingFactory,
 
     @InjectService("AssetBindingFactory")
     BindingFactory assetBindingFactory,
 
     @InjectService("NullFieldStrategyBindingFactory")
     BindingFactory nullFieldStrategyBindingFactory,
 
     @InjectService("ContextBindingFactory")
     BindingFactory contextBindingFactory,
 
     @InjectService("SymbolBindingFactory")
     BindingFactory symbolBindingFactory)
     {
         configuration.add(.new LiteralBindingFactory());
         configuration.add(.new ComponentBindingFactory());
         configuration.add(.new RenderVariableBindingFactory());
         configuration.add(.new BlockBindingFactory());
 
         configuration.add(.propBindingFactory);
         configuration.add(.messageBindingFactory);
         configuration.add(.validateBindingFactory);
         configuration.add(.translateBindingFactory);
         configuration.add(.assetBindingFactory);
         configuration.add(.nullFieldStrategyBindingFactory);
         configuration.add(.contextBindingFactory);
         configuration.add(.symbolBindingFactory);
     }
 
     public static void contributeClasspathAssetAliasManager(MappedConfiguration<StringStringconfiguration,
 
     String applicationVersion,
 
     String appPackage,
 
     ComponentClassResolver resolver)
     {
         configuration.add("tapestry""org/apache/tapestry5");
 
         configuration.add("app"toPackagePath(appPackage));
 
         // Each library gets a mapping or its folder automatically
 
         Map<StringStringfolderToPackageMapping = resolver.getFolderToPackageMapping();
 
         for (String folder : folderToPackageMapping.keySet())
         {
             configuration.add(foldertoPackagePath(folderToPackageMapping.get(folder)));
         }
 
     }

    
Contributes an handler for each mapped classpath alias, as well handlers for context assets and stack assets (combined org.apache.tapestry5.services.javascript.JavaScriptStack files).
 
     public static void contributeAssetDispatcher(MappedConfiguration<StringAssetRequestHandlerconfiguration,
 
     AssetFactory contextAssetFactory,
 
     @Autobuild
     StackAssetRequestHandler stackAssetRequestHandler,
 
     ResourceCache resourceCache,
 
     ClasspathAssetAliasManager classpathAssetAliasManagerResourceStreamer streamer,
             AssetResourceLocator assetResourceLocator)
     {
         resourceCache.addInvalidationListener(stackAssetRequestHandler);
 
         Map<StringStringmappings = classpathAssetAliasManager.getMappings();
 
         for (String folder : mappings.keySet())
         {
             String path = mappings.get(folder);
 
             configuration.add(foldernew ClasspathAssetRequestHandler(streamerassetResourceLocatorpath));
         }
 
         configuration.add(.,
                 new ContextAssetRequestHandler(streamercontextAssetFactory.getRootResource()));
 
         configuration.add(.stackAssetRequestHandler);
 
     }
 
     private static String toPackagePath(String packageName)
     {
         return packageName.replace('.''/');
     }
 
     public static void contributeComponentClassResolver(Configuration<LibraryMappingconfiguration)
     {
         configuration.add(new LibraryMapping("core""org.apache.tapestry5.corelib"));
     }

    
Adds a number of standard component class transform workers:
Retain
Allows fields to retain their values between requests
Persist
Allows fields to store their their value persistently between requests
Parameter
Identifies parameters based on the org.apache.tapestry5.annotations.Parameter annotation
Component
Defines embedded components based on the org.apache.tapestry5.annotations.Component annotation
Mixin
Adds a mixin as part of a component's implementation
Environment
Allows fields to contain values extracted from the Environment service
Inject
Used with the org.apache.tapestry5.ioc.annotations.Inject annotation, when a value is supplied
InjectService
Handles the org.apache.tapestry5.ioc.annotations.InjectService annotation
InjectPage
Adds code to allow access to other pages via the org.apache.tapestry5.annotations.InjectPage field annotation
InjectBlock
Allows a block from the template to be injected into a field
IncludeStylesheet
Supports the org.apache.tapestry5.annotations.IncludeStylesheet annotation
IncludeJavaScriptLibrary
Supports the org.apache.tapestry5.annotations.IncludeJavaScriptLibrary annotation
Import
Supports the org.apache.tapestry5.annotations.Import annotation
SupportsInformalParameters
Checks for the annotation
Meta
Checks for meta data annotations and adds it to the component model
ApplicationState
Converts fields that reference application state objects
UnclaimedField
Identifies unclaimed fields and resets them to null/0/false at the end of the request
RenderCommand
Ensures all components also implement org.apache.tapestry5.runtime.RenderCommand
RenderPhase
Link in render phaes methods
InvokePostRenderCleanupOnResources
Makes sure org.apache.tapestry5.internal.InternalComponentResources.postRenderCleanup() is invoked after a component finishes rendering
GenerateAccessors
Generates accessor methods if org.apache.tapestry5.annotations.Property annotation is present
Cached
Checks for the org.apache.tapestry5.annotations.Cached annotation
Log
Checks for the org.apache.tapestry5.annotations.Log annotation
PageReset
Checks for the org.apache.tapestry5.annotations.PageReset annotation
HeartbeatDeferred
Support for the org.apache.tapestry5.annotations.HeartbeatDeferred annotation
ActivationRequestParameter
Support for the org.apache.tapestry5.annotations.ActivationRequestParameter annotation
 
     public static void contributeComponentClassTransformWorker(
             OrderedConfiguration<ComponentClassTransformWorkerconfiguration,
 
             MetaWorker metaWorker,
 
             ComponentClassResolver resolver)
     {
         configuration.addInstance("Cached"CachedWorker.class);
 
         configuration.add("Meta"metaWorker);
 
         configuration.addInstance("Inject"InjectWorker.class);
         configuration.addInstance("InjectService"InjectServiceWorker.class);
 
         configuration.add("MixinAfter"new MixinAfterWorker());
         configuration.add("Component"new ComponentWorker(resolver));
         configuration.add("Mixin"new MixinWorker(resolver));
         configuration.addInstance("ActivationRequestParameter"ActivationRequestParameterWorker.class,
                 "after:OnEvent");
         configuration.addInstance("OnEvent"OnEventWorker.class);
         configuration.add("SupportsInformalParameters"new SupportsInformalParametersWorker());
         configuration.addInstance("InjectPage"InjectPageWorker.class);
         configuration.addInstance("InjectContainer"InjectContainerWorker.class);
         configuration.addInstance("InjectComponent"InjectComponentWorker.class);
         configuration.add("RenderCommand"new RenderCommandWorker());
 
         // Default values for parameters are often some form of injection, so
         // make sure
         // that Parameter fields are processed after injections.
 
         configuration.addInstance("Parameter"ParameterWorker.class"after:Inject*");
 
         // bind parameter should always go after parameter to make sure all
         // parameters
         // have been properly setup.
 
         configuration.addInstance("BindParameter"BindParameterWorker.class"after:Parameter");
 
         configuration.addInstance("RenderPhase"RenderPhaseMethodWorker.class);
 
         // Ideally, these should be ordered pretty late in the process to make
         // sure there are no
         // side effects with other workers that do work inside the page
         // lifecycle methods.
 
         add(configurationPageLoaded.class."pageLoaded");
         add(configurationPageAttached.class."pageAttached");
         add(configurationPageDetached.class."pageDetached");
 
         configuration.add("Retain"new RetainWorker());
         configuration.addInstance("Persist"PersistWorker.class);
 
         configuration.addInstance("DiscardAfter"DiscardAfterWorker.class);
 
         configuration.addInstance("IncludeStylesheet"IncludeStylesheetWorker.class"after:SetupRender");
         configuration
                 .addInstance("IncludeJavaScriptLibrary"IncludeJavaScriptLibraryWorker.class"after:SetupRender");
         configuration.addInstance("Import"ImportWorker.class"after:SetupRender");
 
         configuration.add("InvokePostRenderCleanupOnResources"new InvokePostRenderCleanupOnResourcesWorker());
 
         configuration.add("Property"new PropertyWorker());
 
         // These must come after Property, since they actually delete fields
         // that may still have the annotation
         configuration.addInstance("ApplicationState"ApplicationStateWorker.class"after:Property");
         configuration.addInstance("Environment"EnvironmentalWorker.class"after:Property");
 
         configuration.addInstance("Log"LogWorker.class);
 
         configuration.addInstance("PageReset"PageResetAnnotationWorker.class);
 
         // This one is always last. Any additional private fields that aren't
         // annotated will
         // be converted to clear out at the end of the request.
 
         configuration.addInstance("UnclaimedField"UnclaimedFieldWorker.class"after:*");
 
         configuration.add("PageActivationContext"new PageActivationContextWorker(), "after:OnEvent");
 
         configuration.addInstance("SessionAttribute"SessionAttributeWorker.class);
 
         configuration.addInstance("HeartbeatDeferred"HeartbeatDeferredWorker.class"after:RenderPhase");
     }

    
 
     public static void contributeDataTypeAnalyzer(OrderedConfiguration<DataTypeAnalyzerconfiguration,
             @InjectService("DefaultDataTypeAnalyzer")
             DataTypeAnalyzer defaultDataTypeAnalyzer)
     {
         configuration.add("Annotation"new AnnotationDataTypeAnalyzer());
         configuration.add("Default"defaultDataTypeAnalyzer"after:*");
     }

    
Maps property types to data type names:
  • String --> text
  • Number --> number
  • Enum --> enum
  • Boolean --> boolean
  • Date --> date
 
     public static void contributeDefaultDataTypeAnalyzer(MappedConfiguration<ClassStringconfiguration)
     {
         // This is a special case contributed to avoid exceptions when a
         // property type can't be
         // matched. DefaultDataTypeAnalyzer converts the empty string to null.
 
         configuration.add(Object.class"");
 
         configuration.add(String.class"text");
         configuration.add(Number.class"number");
         configuration.add(Enum.class"enum");
         configuration.add(Boolean.class"boolean");
         configuration.add(Date.class"date");
         configuration.add(Calendar.class"calendar");
     }
 
     public static void contributeBeanBlockSource(Configuration<BeanBlockContributionconfiguration)
     {
         addEditBlock(configuration"text");
         addEditBlock(configuration"number");
         addEditBlock(configuration"enum");
         addEditBlock(configuration"boolean");
         addEditBlock(configuration"date");
         addEditBlock(configuration"password");
         addEditBlock(configuration"calendar");
 
         // longtext uses a text area, not a text field
 
         addEditBlock(configuration"longtext");
 
         addDisplayBlock(configuration"enum");
         addDisplayBlock(configuration"date");
         addDisplayBlock(configuration"calendar");
 
         // Password and long text have special output needs.
         addDisplayBlock(configuration"password");
         addDisplayBlock(configuration"longtext");
     }
 
     private static void addEditBlock(Configuration<BeanBlockContributionconfigurationString dataType)
     {
         addEditBlock(configurationdataTypedataType);
     }
 
     private static void addEditBlock(Configuration<BeanBlockContributionconfigurationString dataTypeString blockId)
     {
         configuration.add(new BeanBlockContribution(dataType"PropertyEditBlocks"blockIdtrue));
     }
 
     private static void addDisplayBlock(Configuration<BeanBlockContributionconfigurationString dataType)
     {
         addDisplayBlock(configurationdataTypedataType);
     }
 
     private static void addDisplayBlock(Configuration<BeanBlockContributionconfigurationString dataType,
             String blockId)
     {
         configuration.add(new BeanBlockContribution(dataType"PropertyDisplayBlocks"blockIdfalse));
     }

    
Contributes the basic set of validators:
  • required
  • minlength
  • maxlength
  • min
  • max
  • regexp
  • email
  • none
 
     public static void contributeFieldValidatorSource(MappedConfiguration<StringValidatorconfiguration)
     {
         configuration.add("required"new Required());
         configuration.add("minlength"new MinLength());
         configuration.add("maxlength"new MaxLength());
         configuration.add("min"new Min());
         configuration.add("max"new Max());
         configuration.add("regexp"new Regexp());
         configuration.add("email"new Email());
         configuration.add("none"new None());
     }

    
Contributes the base set of injection providers:
Default
based on org.apache.tapestry5.ioc.services.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 org.apache.tapestry5.annotations.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 static void contributeInjectionProvider(OrderedConfiguration<InjectionProviderconfiguration,
 
     MasterObjectProvider masterObjectProvider,
 
     ObjectLocator locator,
 
     SymbolSource symbolSource,
 
     AssetSource assetSource)
     {
         configuration.add("Default"new DefaultInjectionProvider(masterObjectProviderlocator));
 
         configuration.add("ComponentResources"new ComponentResourcesInjectionProvider());
 
         // This comes after default, to deal with conflicts between injecting a
         // String as the
         // component id, and injecting a string with @Symbol or @Value.
 
         configuration.add("CommonResources"new CommonResourcesInjectionProvider(), "after:Default");
 
         configuration.add("Asset"new AssetInjectionProvider(symbolSourceassetSource), "before:Default");
 
         configuration.add("Block"new BlockInjectionProvider(), "before:Default");
 
         // This needs to be the last one, since it matches against services
         // and might blow up if there is no match.
         configuration.add("Service"new ServiceInjectionProvider(locator), "after:*");
     }

    
Contributes two object providers:
Alias
Searches by type among contributions to the Alias service
Asset
Checks for the org.apache.tapestry5.annotations.Path annotation, and injects an org.apache.tapestry5.Asset
Service
Injects based on the org.apache.tapestry5.annotations.Service annotation, if present
ApplicationMessages
Injects the global application messages
 
     public static void contributeMasterObjectProvider(OrderedConfiguration<ObjectProviderconfiguration,
 
     @Local
     final Alias alias,
 
     @InjectService("AssetObjectProvider")
     ObjectProvider assetObjectProvider,
 
     ObjectLocator locator)
     {
         // There's a nasty web of dependencies related to Alias; this wrapper
         // class lets us defer instantiating the Alias service implementation just long enough
         // to defuse those dependencies. The @Local annotation prevents a recursive call through
         // the MasterObjectProvider to resolve the Alias service itself; that is
         // MasterObjectProvider gets built using this proxy, then the proxy will trigger the
         // construction of AliasImpl (which itself needs MasterObjectProvider to resolve some
         // dependencies).
 
         ObjectProvider wrapper = new ObjectProvider()
         {
             public <T> T provide(Class<T> objectTypeAnnotationProvider annotationProviderObjectLocator locator)
             {
                 return alias.getObjectProvider().provide(objectTypeannotationProviderlocator);
             }
         };
 
         configuration.add("Alias"wrapper"after:ServiceOverride");
 
         configuration.add("Asset"assetObjectProvider"before:AnnotationBasedContributions");
 
         configuration.add("Service"new ServiceAnnotationObjectProvider(), "before:AnnotationBasedContributions");
 
         configuration.add("ApplicationMessages"new ApplicationMessageCatalogObjectProvider(locator),
                 "before:AnnotationBasedContributions");
 
     }

    
StoreIntoGlobals
Stores the request and response into RequestGlobals at the start of the pipeline
IgnoredPaths
Identifies requests that are known (via the IgnoredPathsFilter service's configuration) to be mapped to other applications
GZip
Handles GZIP compression of response streams (if supported by client)
 
 
     boolean gzipCompressionEnabled,
 
     @Autobuild
     GZipFilter gzipFilter,
 
     @InjectService("IgnoredPathsFilter")
     HttpServletRequestFilter ignoredPathsFilter)
     {
         configuration.add("IgnoredPaths"ignoredPathsFilter);
 
         configuration.add("GZIP"gzipCompressionEnabled ? gzipFilter : null"after:IgnoredPaths");
 
         HttpServletRequestFilter storeIntoGlobals = new HttpServletRequestFilter()
         {
             public boolean service(HttpServletRequest requestHttpServletResponse response,
                     HttpServletRequestHandler handlerthrows IOException
             {
                 .storeServletRequestResponse(requestresponse);
 
                 return handler.service(requestresponse);
             }
         };
 
         configuration.add("StoreIntoGlobals"storeIntoGlobals"before:*");
     }

    
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 RequestExceptionHandler handle them
StoreIntoGlobals
Stores the request and response into the RequestGlobals service (this is repeated at the end of the pipeline, in case any filter substitutes the request or response).
 
     public void contributeRequestHandler(OrderedConfiguration<RequestFilterconfigurationContext context,
 
     long checkInterval,
 
     long updateTimeout,
 
     UpdateListenerHub updateListenerHub,
 
     URLRewriter urlRewriter)
     {
         RequestFilter staticFilesFilter = new StaticFilesFilter(context);
 
         RequestFilter storeIntoGlobals = new RequestFilter()
         {
             public boolean service(Request requestResponse responseRequestHandler handlerthrows IOException
             {
                 .storeRequestResponse(requestresponse);
 
                 return handler.service(requestresponse);
             }
         };
 
         RequestFilter fireEndOfRequestEvent = new RequestFilter()
         {
             public boolean service(Request requestResponse responseRequestHandler handlerthrows IOException
             {
                 try
                 {
                     return handler.service(requestresponse);
                 }
                 finally
                 {
                     .fire();
                 }
             }
         };
 
         configuration.add("CheckForUpdates",
                 new CheckForUpdatesFilter(updateListenerHubcheckIntervalupdateTimeout), "before:*");
 
         // we just need the URLRewriterRequestFilter if we have URL rewriter
         // rules, of course.
         if (urlRewriter.hasRequestRules())
         {
 
             URLRewriterRequestFilter urlRewriterRequestFilter = new URLRewriterRequestFilter(urlRewriter);
            configuration.add("URLRewriter"urlRewriterRequestFilter"before:StaticFiles");
        }
        configuration.add("StaticFiles"staticFilesFilter);
        configuration.addInstance("ErrorFilter"RequestErrorFilter.class);
        configuration.add("StoreIntoGlobals"storeIntoGlobals"after:StaticFiles""before:ErrorFilter");
        configuration.add("EndOfRequest"fireEndOfRequestEvent"after:StoreIntoGlobals""before:ErrorFilter");
    }

    
Contributes the basic set of translators:
  • string
  • byte
  • short
  • integer
  • long
  • float
  • double
  • BigInteger
  • BigDecimal
    public static void contributeTranslatorSource(MappedConfiguration<ClassTranslatorconfiguration,
            NumericTranslatorSupport support)
    {
        configuration.add(String.classnew StringTranslator());
        Class[] types = new Class[]
        { Byte.classShort.classInteger.classLong.classFloat.classDouble.classBigInteger.class,
                BigDecimal.class };
        for (Class type : types)
        {
            String name = type.getSimpleName().toLowerCase();
            configuration.add(typenew NumericTranslator(nametypesupport));
        }
    }

    
    public static void contributeTypeCoercer(Configuration<CoercionTupleconfiguration,
    @Builtin
    TypeCoercer coercer,
    @Builtin
    final ThreadLocale threadLocale,
    @Core
    final AssetSource assetSource)
    {
        configuration.add(CoercionTuple.create(ComponentResources.classPropertyOverrides.class,
                new Coercion<ComponentResourcesPropertyOverrides>()
                {
                    public PropertyOverrides coerce(ComponentResources input)
                    {
                        return new PropertyOverridesImpl(input);
                    }
                }));
        configuration.add(CoercionTuple.create(String.classSelectModel.classnew Coercion<StringSelectModel>()
        {
            public SelectModel coerce(String input)
            {
                return TapestryInternalUtils.toSelectModel(input);
            }
        }));
        configuration.add(CoercionTuple.create(Map.classSelectModel.classnew Coercion<MapSelectModel>()
        {
            @SuppressWarnings("unchecked")
            public SelectModel coerce(Map input)
            {
                return TapestryInternalUtils.toSelectModel(input);
            }
        }));
        configuration.add(CoercionTuple.create(Collection.classGridDataSource.class,
                new Coercion<CollectionGridDataSource>()
                {
                    public GridDataSource coerce(Collection input)
                    {
                        return new CollectionGridDataSource(input);
                    }
                }));
        configuration.add(CoercionTuple.create(void.classGridDataSource.classnew Coercion<VoidGridDataSource>()
        {
            private final GridDataSource source = new NullDataSource();
            public GridDataSource coerce(Void input)
            {
                return ;
            }
        }));
        add(configurationGridPagerPosition.class);
        add(configurationInsertPosition.class);
        add(configurationBlankOption.class);
        add(configurationLoopFormState.class);
        add(configurationSubmitMode.class);
        configuration.add(CoercionTuple.create(List.classSelectModel.classnew Coercion<ListSelectModel>()
        {
            @SuppressWarnings("unchecked")
            public SelectModel coerce(List input)
            {
                return TapestryInternalUtils.toSelectModel(input);
            }
        }));
        configuration.add(CoercionTuple.create(String.classPattern.classnew Coercion<StringPattern>()
        {
            public Pattern coerce(String input)
            {
                return Pattern.compile(input);
            }
        }));
        configuration.add(CoercionTuple.create(ComponentResourcesAware.classComponentResources.class,
                new Coercion<ComponentResourcesAwareComponentResources>()
                {
                    public ComponentResources coerce(ComponentResourcesAware input)
                    {
                        return input.getComponentResources();
                    }
                }));
        configuration.add(CoercionTuple.create(String.classRenderable.classnew Coercion<StringRenderable>()
        {
            public Renderable coerce(String input)
            {
                return new StringRenderable(input);
            }
        }));
        configuration.add(CoercionTuple.create(Renderable.classBlock.classnew Coercion<RenderableBlock>()
        {
            public Block coerce(Renderable input)
            {
                return new RenderableAsBlock(input);
            }
        }));
        configuration.add(CoercionTuple.create(String.classDateFormat.classnew Coercion<StringDateFormat>()
        {
            public DateFormat coerce(String input)
            {
                return new SimpleDateFormat(inputthreadLocale.getLocale());
            }
        }));
        configuration.add(CoercionTuple.create(String.classResource.classnew Coercion<StringResource>()