KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > tapestry > engine > ServiceEncoding


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 servlet path plus and
19  * query parameters. The service encoding is passed to each
20  * {@link org.apache.tapestry.engine.ServiceEncoder} , which is allowed to modify the encoding
21  * (typically, by changing the servlet path and settting query parameters to null). From this
22  * modified encoding, an {@link org.apache.tapestry.engine.ILink}can be constructed.
23  * <p>
24  * Additionally, when a request is dispatched by Tapestry, an SRE is also created and passed to each
25  * {@link org.apache.tapestry.engine.ServiceEncoder}&nbsp;for decoding. Here, the query parameters
26  * that may have been nulled out by the encoding are restored.
27  *
28  * @author Howard M. Lewis Ship
29  * @since 4.0
30  * @see org.apache.tapestry.services.ServiceConstants
31  */

32 public interface ServiceEncoding
33 {
34
35     /**
36      * Returns the value for the named parameter. If multiple values are stored for the query
37      * parameter, only the first is returned.
38      *
39      * @parameter name the name of the query parameter to access
40      * @return the value, or null if no such query parameter exists
41      */

42
43     public String JavaDoc getParameterValue(String JavaDoc name);
44
45     /**
46      * Returns the value for the named parameter.
47      *
48      * @parameter name the name of the query parameter to access
49      * @return the values, or null if no such query parameter exists
50      */

51     public String JavaDoc[] getParameterValues(String JavaDoc name);
52
53     /**
54      * Updates the servlet path for the encoding.
55      */

56
57     public void setServletPath(String JavaDoc servletPath);
58
59     /**
60      * Sets the value for the named query parameter to the provided string.
61      *
62      * @param name
63      * the name of the parameter to set.
64      * @param value
65      * the new value, which may be null.
66      */

67     public void setParameterValue(String JavaDoc name, String JavaDoc value);
68
69     /**
70      * Sets the values for a named query parameter.
71      */

72
73     public void setParameterValues(String JavaDoc name, String JavaDoc[] values);
74
75     /**
76      * Returns the servlet path for the request.
77      */

78
79     public String JavaDoc getServletPath();
80
81     /**
82      * Returns an array of parameter names. The names are returned in alphabetically sorted order.
83      * This list includes all parameter names, even those for which the stored value is null.
84      */

85
86     public String JavaDoc[] getParameterNames();
87
88 }
Popular Tags