Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
ServiceEncoding |
|
| 1.0;1 |
1 | // Copyright 2004, 2005 The Apache Software Foundation | |
2 | // | |
3 | // Licensed under the Apache License, Version 2.0 (the "License"); | |
4 | // you may not use this file except in compliance with the License. | |
5 | // You may obtain a copy of the License at | |
6 | // | |
7 | // http://www.apache.org/licenses/LICENSE-2.0 | |
8 | // | |
9 | // Unless required by applicable law or agreed to in writing, software | |
10 | // distributed under the License is distributed on an "AS IS" BASIS, | |
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
12 | // See the License for the specific language governing permissions and | |
13 | // limitations under the License. | |
14 | ||
15 | package org.apache.tapestry.engine; | |
16 | ||
17 | /** | |
18 | * Contains the information needed to encode a request for a service; the | |
19 | * servlet path plus and query parameters. The service encoding is passed to | |
20 | * each {@link org.apache.tapestry.engine.ServiceEncoder} , which is | |
21 | * allowed to modify the encoding (typically, by changing the servlet path and | |
22 | * settting query parameters to null). From this modified encoding, an | |
23 | * {@link org.apache.tapestry.engine.ILink}can be constructed. | |
24 | * <p> | |
25 | * Additionally, when a request is dispatched by Tapestry, an SRE is also | |
26 | * created and passed to each {@link org.apache.tapestry.engine.ServiceEncoder} for | |
27 | * decoding. Here, the query parameters that may have been nulled out by the | |
28 | * encoding are restored. | |
29 | * | |
30 | * @author Howard M. Lewis Ship | |
31 | * @since 4.0 | |
32 | * @see org.apache.tapestry.services.ServiceConstants | |
33 | */ | |
34 | public interface ServiceEncoding | |
35 | { | |
36 | ||
37 | /** | |
38 | * Returns the value for the named parameter. If multiple values are stored | |
39 | * for the query parameter, only the first is returned. | |
40 | * | |
41 | * @parameter name the name of the query parameter to access | |
42 | * @return the value, or null if no such query parameter exists | |
43 | */ | |
44 | ||
45 | String getParameterValue(String name); | |
46 | ||
47 | /** | |
48 | * Returns the value for the named parameter. | |
49 | * | |
50 | * @parameter name the name of the query parameter to access | |
51 | * @return the values, or null if no such query parameter exists | |
52 | */ | |
53 | String[] getParameterValues(String name); | |
54 | ||
55 | /** | |
56 | * Updates the servlet path for the encoding. In some cases, this is a | |
57 | * combination of the servlet and additional path info. | |
58 | */ | |
59 | ||
60 | void setServletPath(String servletPath); | |
61 | ||
62 | /** | |
63 | * Sets the value for the named query parameter to the provided string. | |
64 | * | |
65 | * @param name | |
66 | * the name of the parameter to set. | |
67 | * @param value | |
68 | * the new value, which may be null. | |
69 | */ | |
70 | void setParameterValue(String name, String value); | |
71 | ||
72 | /** | |
73 | * Sets the values for a named query parameter. | |
74 | */ | |
75 | ||
76 | void setParameterValues(String name, String[] values); | |
77 | ||
78 | /** | |
79 | * Returns the servlet path for the request. This is the portion of the URL | |
80 | * recognized as the servlet. When the URL pattern (in web.xml) ends in a | |
81 | * "*" (such as "/book/*"), this method will return the matched servlet | |
82 | * portion ("/book/") and {#link #getPathInfo} will return the rest of the | |
83 | * URL. | |
84 | */ | |
85 | ||
86 | String getServletPath(); | |
87 | ||
88 | /** | |
89 | * Returns the portion of the URL after the servlet itself. | |
90 | * | |
91 | * @return pathInfo if path info was supplied in the request, or null | |
92 | * otherwise. | |
93 | */ | |
94 | String getPathInfo(); | |
95 | ||
96 | /** | |
97 | * Returns an array of parameter names. The names are returned in | |
98 | * alphabetically sorted order. This list includes all parameter names, even | |
99 | * those for which the stored value is null. | |
100 | */ | |
101 | ||
102 | String[] getParameterNames(); | |
103 | } |