Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
PortletLinkFactoryImpl |
|
| 1.0;1 |
1 | // Copyright 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.portlet; | |
16 | ||
17 | import java.util.Map; | |
18 | ||
19 | import javax.portlet.PortletURL; | |
20 | import javax.portlet.RenderResponse; | |
21 | ||
22 | import org.apache.tapestry.engine.IEngineService; | |
23 | import org.apache.tapestry.engine.ILink; | |
24 | import org.apache.tapestry.services.impl.LinkFactoryImpl; | |
25 | import org.apache.tapestry.util.QueryParameterMap; | |
26 | ||
27 | /** | |
28 | * Extended version of {@link org.apache.tapestry.services.impl.LinkFactoryImpl} that | |
29 | * can create generate Portlet URLs. | |
30 | * | |
31 | * @author Howard M. Lewis Ship | |
32 | * @since 4.0 | |
33 | */ | |
34 | 0 | public class PortletLinkFactoryImpl extends LinkFactoryImpl |
35 | { | |
36 | ||
37 | private RenderResponse _renderResponse; | |
38 | ||
39 | public void setRenderResponse(RenderResponse renderResponse) | |
40 | { | |
41 | 0 | _renderResponse = renderResponse; |
42 | 0 | } |
43 | ||
44 | public ILink constructLink(IEngineService service, boolean post, | |
45 | Map parameters, boolean stateful) | |
46 | { | |
47 | 0 | finalizeParameters(service, parameters); |
48 | ||
49 | 0 | PortletURL url = _renderResponse.createActionURL(); |
50 | ||
51 | 0 | return new PortletLink(url, new QueryParameterMap(parameters)); |
52 | } | |
53 | } |