|
|||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
LinkFactory.java | - | - | - | - |
|
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.services; | |
16 | ||
17 | import java.util.Map; | |
18 | ||
19 | import org.apache.tapestry.IRequestCycle; | |
20 | import org.apache.tapestry.engine.IEngineService; | |
21 | import org.apache.tapestry.engine.ILink; | |
22 | import org.apache.tapestry.engine.ServiceEncoder; | |
23 | ||
24 | /** | |
25 | * A source of {@link org.apache.tapestry.engine.ILink}instances. This is primarily used by | |
26 | * {@link org.apache.tapestry.engine.IEngineService}s. | |
27 | * | |
28 | * @author Howard M. Lewis Ship | |
29 | * @since 4.0 | |
30 | */ | |
31 | public interface LinkFactory | |
32 | { | |
33 | /** | |
34 | * Constructs an {@link org.apache.tapestry.engine.ILink}. | |
35 | * | |
36 | * @param service | |
37 | * the service for which the link is being generated | |
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 parameters | |
42 | * A map; keys are strings and values are strings or string arrays (exception: key | |
43 | * {@link ServiceConstants#PARAMETER} is an array of objects. Certain keys, defined | |
44 | * in {@link ServiceConstants} may have special meaning. The map will typically be | |
45 | * modified internally. May not be null. | |
46 | * @param stateful | |
47 | * If true, then the final URL should be encoded (with the session id) if necessary. | |
48 | * If false, the session encoding should not occur. The latter case is useful for | |
49 | * services that will absolutely not need any access to user-specific state. | |
50 | */ | |
51 | public ILink constructLink(IEngineService service, boolean post, Map parameters, | |
52 | boolean stateful); | |
53 | ||
54 | /** | |
55 | * A secondary function of the service is to convert encoded (aka "squeezed") listener | |
56 | * parameters back into an array of Objects. This does (barely) makes sense .. the link factory | |
57 | * is responsible for encoding the listener parameters, it should be responsible for decoding | |
58 | * them. | |
59 | * | |
60 | * @param cycle | |
61 | * the current request cycle | |
62 | * @return an array of Object[]. May return an empty array, but won't return null. | |
63 | */ | |
64 | ||
65 | public Object[] extractListenerParameters(IRequestCycle cycle); | |
66 | ||
67 | /** | |
68 | * Returns an array of {@link org.apache.tapestry.engine.ServiceEncoder}, ordering into | |
69 | * execution order. May return an empty array, but won't return null. | |
70 | */ | |
71 | ||
72 | public ServiceEncoder[] getServiceEncoders(); | |
73 | } |
|