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