The Spring Framework

Package org.springframework.web.servlet.handler.metadata

This package enables automatic web controller targeting.

See:
          Description

Class Summary
AbstractPathMapHandlerMapping Deprecated. as of Spring 2.5, in favor of annotation-based request mapping.
CommonsPathMapHandlerMapping Deprecated. as of Spring 2.5, in favor of annotation-based request mapping.
PathMap Deprecated. as of Spring 2.5, in favor of annotation-based request mapping.
 

Package org.springframework.web.servlet.handler.metadata Description

This package enables automatic web controller targeting. The only implementation at present is CommonsPathMapHandlerMapping, based on Commons Attributes source-level attributes, but metadata implementation is pluggable.
In this model, you don't need to map URLs onto controllers in your Spring XML web application context bean definition files. You merely need to set one or more PathMap attributes on each of your Controller classes, and new objects of these types will automatically be added to the relevant web application context.
Dependencies--whether expressed by via constructor arguments or JavaBean properties, will be resolved if possible using the middle tier definitions in the WebApplicationContext.

To use this feature, using the Commons Attributes implementation, perform the following steps:

  1. Invoke the Commons Attributes compiler on your application classes. The classes must be compiled into a Jar rather than the WEB-INF/classes directory.
  2. Run the Commons Attributes attribute indexer tool on the Jar containing your controllers.
  3. Use Commons Attributes syntax to define a PathMap attribute for each Controller you want mapped.
  4. Define a bean of type UrlHandlerMapping in your servletName-servlet.xml bean definition file in your web application. No parameters are required.

You can also use other HandlerMappings, such as BeanNameHandlerMapping, in the same servlet XML file.


The Spring Framework

Copyright © 2002-2008 The Spring Framework.