1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.struts2.dispatcher.mapper;
19
20 import javax.servlet.http.HttpServletRequest;
21
22 import com.opensymphony.xwork2.config.ConfigurationManager;
23
24
25 /***
26 * <!-- START SNIPPET: javadoc -->
27 *
28 * The ActionMapper is responsible for providing a mapping between HTTP requests and action invocation requests and
29 * vice-versa. When given an HttpServletRequest, the ActionMapper may return null if no action invocation request maps,
30 * or it may return an {@link ActionMapping} that describes an action invocation that Struts should attempt to try. The
31 * ActionMapper is not required to guarantee that the {@link ActionMapping} returned be a real action or otherwise
32 * ensure a valid request. This means that most ActionMappers do not need to consult the Struts configuration to
33 * determine if a request should be mapped.
34 *
35 * <p/> Just as requests can be mapped from HTTP to an action invocation, the opposite is true as well. However, because
36 * HTTP requests (when shown in HTTP responses) must be in String form, a String is returned rather than an actual
37 * request object.
38 *
39 * <!-- END SNIPPET: javadoc -->
40 */
41 public interface ActionMapper {
42
43 /***
44 * Gets an action mapping for the current request
45 *
46 * @param request The servlet request
47 * @param config The current configuration manager
48 * @return The appropriate action mapping
49 */
50 ActionMapping getMapping(HttpServletRequest request, ConfigurationManager configManager);
51
52 /***
53 * Converts an ActionMapping into a URI string
54 *
55 * @param mapping The action mapping
56 * @return The URI string that represents this mapping
57 */
58 String getUriFromActionMapping(ActionMapping mapping);
59 }