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