KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cocoon > portal > LinkService


1 /*
2  * Copyright 1999-2002,2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.cocoon.portal;
17
18 import java.util.List JavaDoc;
19
20 import org.apache.avalon.framework.component.Component;
21 import org.apache.cocoon.portal.event.Event;
22
23 /**
24  *
25  * @author <a HREF="mailto:cziegeler@s-und-n.de">Carsten Ziegeler</a>
26  * @author <a HREF="mailto:volker.schmitt@basf-it-services.com">Volker Schmitt</a>
27  *
28  * @version CVS $Id: LinkService.java 233139 2005-08-17 09:32:20Z cziegeler $
29  */

30 public interface LinkService extends Component {
31
32     String JavaDoc ROLE = LinkService.class.getName();
33     
34     String JavaDoc DEFAULT_REQUEST_EVENT_PARAMETER_NAME = "cocoon-portal-event";
35     String JavaDoc DEFAULT_CONVERTABLE_EVENT_PARAMETER_NAME = "javax.portlet.events";
36
37
38     static class ParameterDescription {
39         public final String JavaDoc parameters;
40         public ParameterDescription(String JavaDoc parameters) {
41             this.parameters = parameters;
42         }
43     }
44     /**
45      * Get the uri for this coplet containing the additional event
46      * @param event The event to add (null is also allowed for convenience)
47      * @return A URI
48      */

49     String JavaDoc getLinkURI(Event event);
50
51     /**
52      * Get the uri for this coplet containing the additional event and using a secure
53      * protocol if requested.
54      *
55      * @param event The event to add (null is also allowed for convenience)
56      * @param secure true if a secure protocol is required, false otherwise.
57      * @return A URI
58      */

59     String JavaDoc getLinkURI(Event event, Boolean JavaDoc secure);
60
61     /**
62      * Get the uri for this coplet containing the additional events.
63      * @param events The events to add: These can either be {@link Event}s or {@link ParameterDescription}s.
64      * @return A URI
65      */

66     String JavaDoc getLinkURI(List JavaDoc events);
67
68     /**
69      * Get a uri for this coplet containing the additional events. Use a secure
70      * protocol if requested.
71      * @param events The events to add: These can either be {@link Event}s or {@link ParameterDescription}s.
72      * @param secure true if a secure protocol is required, false otherwise.
73      * @return A URI
74      */

75     String JavaDoc getLinkURI(List JavaDoc events, Boolean JavaDoc secure);
76
77     /**
78      * Add this event to the list of events contained in the uri
79      * @param event Event to add
80      */

81     void addEventToLink(Event event);
82     
83     /**
84      * Add this parameter to every link.
85      * If the link already contains a parameter with this name,
86      * then the link will have both parameters with the same
87      * name, but different values.
88      * @param name The request parameter name
89      * @param value The value for the parameter
90      * @see #addUniqueParameterToLink(String, String)
91      */

92     void addParameterToLink(String JavaDoc name, String JavaDoc value);
93     
94     /**
95      * Add this parameter to every link.
96      * If the link already contains a parameter with this name,
97      * then this old parameter will be removed and replaced by
98      * the new one.
99      * @param name The request parameter name
100      * @param value The value for the parameter
101      * @see #addUniqueParameterToLink(String, String)
102      */

103     void addUniqueParameterToLink(String JavaDoc name, String JavaDoc value);
104
105     /**
106      * Get a link that simply refreshs the portal
107      * @return A URI
108      */

109     String JavaDoc getRefreshLinkURI();
110
111     /**
112      * Get a link that simply refreshs the portal
113      * @param secure true if a secure protocol is required, false otherwise.
114      * @return A URI
115      */

116     String JavaDoc getRefreshLinkURI(Boolean JavaDoc secure);
117
118     /**
119      * Determine whether the current url is using a secure protocol
120      * @return true if the current url is using a secure protocol
121      */

122     boolean isSecure();
123
124     /**
125      * @param url The url to encode.
126      * @return The enocoded URL.
127      * @see javax.servlet.http.HttpServletResponse#encodeURL(java.lang.String)
128      */

129     String JavaDoc encodeURL(String JavaDoc url);
130 }
Popular Tags