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
  // 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;
The TapestryFilter is responsible for intercepting all requests into the web application. It identifies the requests that are relevant to Tapestry, and lets the servlet container handle the rest. It is also responsible for initializing Tapestry.

The application is primarily configured via context-level init parameters.
The application package (used to search for pages, components, etc.)

In addition, a JVM system property affects configuration: tapestry.execution-mode (with default value "production"). This property is a comma-separated list of execution modes. For each mode, an additional init parameter is checked for: tapestry.mode-modules; this is a comma-separated list of module class names to load. In this way, more precise control over the available modules can be obtained which is often needed during testing.

 public class TapestryFilter implements Filter
     private final Logger logger = LoggerFactory.getLogger(TapestryFilter.class);
     private FilterConfig config;
     private Registry registry;
     private HttpServletRequestHandler handler;

Key under which that Tapestry IoC org.apache.tapestry5.ioc.Registry is stored in the ServletContext. This allows other code, beyond Tapestry, to obtain the Registry and, from it, any Tapestry services. Such code should be careful about invoking org.apache.tapestry5.ioc.Registry.cleanupThread() appropriately.
     public static final String REGISTRY_CONTEXT_NAME = "org.apache.tapestry5.application-registry";

Initializes the filter using the org.apache.tapestry5.internal.TapestryAppInitializer. The application name is the capitalization of the filter name (as specified in web.xml).
     public final void init(FilterConfig filterConfigthrows ServletException
          = filterConfig;
         ServletContext context = .getServletContext();
         String filterName = .getFilterName();
         SymbolProvider provider = new ServletContextSymbolProvider(context);
         String executionMode = System.getProperty("tapestry.execution-mode""production");
         TapestryAppInitializer appInitializer = new TapestryAppInitializer(provider,
          = appInitializer.createRegistry();
         ServletApplicationInitializer ai = .getService("ServletApplicationInitializer",
         = .getService("HttpServletRequestHandler"HttpServletRequestHandler.class);
    protected final FilterConfig getFilterConfig()
        return ;

Invoked from init(javax.servlet.FilterConfig) after the Registry has been created, to allow any additional initialization to occur. This implementation does nothing, and my be overriden in subclasses.

registry from which services may be extracted
    protected void init(Registry registrythrows ServletException

Overridden in subclasses to provide additional module definitions beyond those normally located. This implementation returns an empty array.
    protected ModuleDef[] provideExtraModuleDefs(ServletContext context)
        return new ModuleDef[0];
    public final void doFilter(ServletRequest requestServletResponse responseFilterChain chain)
            throws IOExceptionServletException
            boolean handled = .service((HttpServletRequestrequest,
            if (!handled)

Shuts down and discards the registry. Invokes destroy(org.apache.tapestry5.ioc.Registry) to allow subclasses to peform any shutdown logic, then shuts down the registry, and removes it from the ServletContext.
    public final void destroy()
         = null;
         = null;
         = null;

Invoked from destroy() to allow subclasses to add additional shutdown logic to the filter. The Registry will be shutdown after this call. This implementation does nothing, and may be overridden in subclasses.

    protected void destroy(Registry registry)
New to GrepCode? Check out our FAQ X