org.apache.struts2.dispatcher.mapper
接口 ActionMapper

所有已知实现类:
CompositeActionMapper, DefaultActionMapper, PrefixBasedActionMapper, Restful2ActionMapper, RestfulActionMapper

public interface ActionMapper

The ActionMapper interface provides a mapping between HTTP requests and action invocation requests and vice-versa.

When given an HttpServletRequest, the ActionMapper may return null if no action invocation request matches, or it may return an ActionMapping that describes an action invocation for the framework to try.

The ActionMapper is not required to guarantee that the ActionMapping returned be a real action or otherwise ensure a valid request. Accordingly, most ActionMappers do not need to consult the Struts configuration just to determine if a request should be mapped.

Just as requests can be mapped from HTTP to an action invocation, the opposite is true as well. However, because HTTP requests (when shown in HTTP responses) must be in String form, a String is returned rather than an actual request object.


方法摘要
 ActionMapping getMapping(javax.servlet.http.HttpServletRequest request, com.opensymphony.xwork2.config.ConfigurationManager configManager)
          Expose the ActionMapping for the current request
 ActionMapping getMappingFromActionName(String actionName)
          Expose the ActionMapping for the specified action name
 String getUriFromActionMapping(ActionMapping mapping)
          Convert an ActionMapping into a URI string
 

方法详细信息

getMapping

ActionMapping getMapping(javax.servlet.http.HttpServletRequest request,
                         com.opensymphony.xwork2.config.ConfigurationManager configManager)
Expose the ActionMapping for the current request

参数:
request - The servlet request
configManager - The current configuration manager
返回:
The appropriate action mapping or null if mapping cannot be determined

getMappingFromActionName

ActionMapping getMappingFromActionName(String actionName)
Expose the ActionMapping for the specified action name

参数:
actionName - The name of the action that may have other information embedded in it
返回:
The appropriate action mapping
从以下版本开始:
2.1.1

getUriFromActionMapping

String getUriFromActionMapping(ActionMapping mapping)
Convert an ActionMapping into a URI string

参数:
mapping - The action mapping
返回:
The URI string that represents this mapping