站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > Spring Framework 2.0.5 API 文档英文版

org.springframework.web.servlet.handler.metadata (Spring Framework API 2.0) - Spring Framework 2.0.5 API 文档英文版

The Spring Framework

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

This package enables automatic web controller targeting.

See:
          Description

Class Summary
AbstractPathMapHandlerMapping Abstract implementation of the HandlerMapping interface that recognizes metadata attributes of type PathMap on application Controllers and automatically wires them into the current servlet's WebApplicationContext.
CommonsPathMapHandlerMapping 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.
PathMap Attribute to be used on Controller classes to allow for automatic URL mapping without web controllers being defined as beans in an XML bean definition file.
 

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-2007 The Spring Framework.