Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||||
IEngineService |
|
| 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 | import java.io.IOException; |
|
18 | ||
19 | import org.apache.tapestry.IRequestCycle; |
|
20 | ||
21 | /** |
|
22 | * A service, provided by the {@link org.apache.tapestry.IEngine}, for its pages and/or components. |
|
23 | * Services are responsible for constructing {@link EngineServiceLink}s (an encoding of URLs) to |
|
24 | * represent dynamic application behavior, and for parsing those URLs when a subsequent request |
|
25 | * involves them. |
|
26 | * |
|
27 | * @author Howard Lewis Ship |
|
28 | */ |
|
29 | ||
30 | public interface IEngineService |
|
31 | { |
|
32 | /** |
|
33 | * Builds a URL for a service. This is performed during the rendering phase of one request cycle |
|
34 | * and builds URLs that will invoke activity in a subsequent request cycle. |
|
35 | * <p> |
|
36 | * <b>This method changed incompatibly between release 3.0 and release 4.0. </b> |
|
37 | * </p> |
|
38 | * @param post |
|
39 | * if true, then the link will be used for a post (not a get, i.e., for a HTML form); |
|
40 | * this may affect what information is encoded into the link |
|
41 | * @param parameter |
|
42 | * An object that provide any additional information needed by the service. Each |
|
43 | * service implementation will expect that an object of the proper type be passed in. |
|
44 | * In some cases, a simple String will do; in others, a specific object (possibly |
|
45 | * implementing an interface) will be required. |
|
46 | * |
|
47 | * @return The URL for the service. The URL will have to be encoded via |
|
48 | * {@link javax.servlet.http.HttpServletResponse#encodeURL(java.lang.String)}. |
|
49 | */ |
|
50 | ||
51 | ILink getLink(boolean post, Object parameter); |
|
52 | ||
53 | /** |
|
54 | * Perform the service, interpreting the URL (from the |
|
55 | * {@link javax.servlet.http.HttpServletRequest}) responding appropriately, and rendering a |
|
56 | * result page. |
|
57 | * |
|
58 | * @param cycle |
|
59 | * the incoming request |
|
60 | */ |
|
61 | ||
62 | void service(IRequestCycle cycle) throws IOException; |
|
63 | ||
64 | /** |
|
65 | * Returns the name of the service. |
|
66 | * |
|
67 | * @since 1.0.1 |
|
68 | */ |
|
69 | ||
70 | String getName(); |
|
71 | } |