Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| The Spring Framework
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.springframework.web.servlet.handler.metadata
Class CommonsPathMapHandlerMapping

    java.lang.Object
      org.springframework.context.support.ApplicationObjectSupport
          org.springframework.web.context.support.WebApplicationObjectSupport
              org.springframework.web.servlet.handler.AbstractHandlerMapping
                  org.springframework.web.servlet.handler.AbstractUrlHandlerMapping
                      org.springframework.web.servlet.handler.metadata.AbstractPathMapHandlerMapping
                          org.springframework.web.servlet.handler.metadata.CommonsPathMapHandlerMapping

All Implemented Interfaces:
  ApplicationContextAware, Ordered, ServletContextAware, HandlerMapping

    public class CommonsPathMapHandlerMapping

extends AbstractPathMapHandlerMapping

Subclass of AbstractPathMapHandlerMapping that recognizes Commons Attributes metadata attributes of type PathMap on application Controllers and automatically wires them into the current servlet's WebApplicationContext.

Controllers must have class attributes of the form: `&64;org.springframework.web.servlet.handler.commonsattributes.PathMap("/path.cgi")`

The path must be mapped to the relevant Spring DispatcherServlet in /WEB-INF/web.xml. It's possible to have multiple PathMap attributes on the one controller class.

To use this feature, you must compile application classes with Commons Attributes, and run the Commons Attributes indexer tool on your application classes, which must be in a Jar rather than in WEB-INF/classes.

Controllers instantiated by this class may have dependencies on middle tier objects, expressed via JavaBean properties or constructor arguments. These will be resolved automatically.

You will normally use this HandlerMapping with at most one DispatcherServlet in your web application. Otherwise you'll end with one instance of the mapped controller for each DispatcherServlet's context. You might want this--for example, if one's using a .pdf mapping and a PDF view, and another a JSP view, or if using different middle tier objects, but should understand the implications. All Controllers with attributes will be picked up by each DispatcherServlet's context.

Author:
  Rod Johnson, Juergen Hoeller

Field Summary

Fields inherited from class org.springframework.context.support.ApplicationObjectSupport
`logger`

Fields inherited from interface org.springframework.web.servlet.HandlerMapping
`PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE`

Fields inherited from interface org.springframework.core.Ordered
`HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE`

Constructor Summary
`CommonsPathMapHandlerMapping()`

Method Summary
`protected Class[]` | `getClassesWithPathMapAttributes()` Use Commons Attributes AttributeIndex to get a Collection of Class objects with the required PathMap attribute.
`protected PathMap[]` | `getPathMapAttributes(Class handlerClass)` Use Commons Attributes to find PathMap attributes for the given class.

Methods inherited from class org.springframework.web.servlet.handler.metadata.AbstractPathMapHandlerMapping
`detectAndCreateHandlers, initApplicationContext, registerHandler, setAutowireMode, setAutowireModeName, setDependencyCheck`

Methods inherited from class org.springframework.web.servlet.handler.AbstractUrlHandlerMapping
`buildPathExposingHandler, exposePathWithinMapping, getHandlerInternal, getHandlerMap, getRootHandler, lookupHandler, registerHandler, registerHandler, setAlwaysUseFullPath, setLazyInitHandlers, setPathMatcher, setRootHandler, setUrlDecode, setUrlPathHelper`

Methods inherited from class org.springframework.web.servlet.handler.AbstractHandlerMapping
`adaptInterceptor, extendInterceptors, getAdaptedInterceptors, getDefaultHandler, getHandler, getHandlerExecutionChain, getOrder, initInterceptors, setDefaultHandler, setInterceptors, setOrder`

Methods inherited from class org.springframework.web.context.support.WebApplicationObjectSupport
`getServletContext, getTempDir, getWebApplicationContext, isContextRequired, setServletContext`

Methods inherited from class org.springframework.context.support.ApplicationObjectSupport
`getApplicationContext, getMessageSourceAccessor, requiredContextClass, setApplicationContext`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### CommonsPathMapHandlerMapping

    public CommonsPathMapHandlerMapping()

Method Detail

### getClassesWithPathMapAttributes

    protected Class[] getClassesWithPathMapAttributes()
                                               throws Exception

  Use Commons Attributes AttributeIndex to get a Collection of Class objects with the required PathMap attribute. Protected so that it can be overridden during testing.

  Specified by:
    `getClassesWithPathMapAttributes` in class `AbstractPathMapHandlerMapping`
  Returns:
    a array of Class objects
  Throws:
    `Exception`

### getPathMapAttributes

    protected PathMap[] getPathMapAttributes(Class handlerClass)

  Use Commons Attributes to find PathMap attributes for the given class. We know there's at least one, as the getClassNamesWithPathMapAttributes method return this class name.

  Specified by:
    `getPathMapAttributes` in class `AbstractPathMapHandlerMapping`
  Parameters:
    `handlerClass` - the handler class to look for
  Returns:
    an array of PathMap objects

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| The Spring Framework
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002-2007 The Spring Framework.