KickJava   Java API By Example, From Geeks To Geeks.

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


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  * Define a link that may be generated as part of a page render. The vast majority of links are tied
19  * to {@link IEngineService services}and are, in fact, callbacks. A small number, such as those
20  * generated by {@link org.apache.tapestry.link.GenericLink}component, are to arbitrary locations.
21  * In addition, ILink differentiates between the path portion of the link, and any query parameters
22  * encoded into a link, primarily to benefit {@link org.apache.tapestry.form.Form}, which needs to
23  * encode the query parameters as hidden form fields.
24  * <p>
25  * In addition, an ILink is responsible for passing constructed URLs through
26  * {@link org.apache.tapestry.IRequestCycle#encodeURL(String)}as needed.
27  *
28  * @author Howard Lewis Ship
29  * @since 3.0
30  */

31
32 public interface ILink
33 {
34     /**
35      * Returns the relative URL as a String. A relative URL may include a leading slash, but omits
36      * the scheme, host and port portions of a full URL.
37      *
38      * @return the relative URL, with no anchor, but including query parameters.
39      */

40
41     public String JavaDoc getURL();
42
43     /**
44      * Returns the relative URL as a String. This is used for most links.
45      *
46      * @param anchor
47      * if not null, appended to the URL
48      * @param includeParameters
49      * if true, parameters are included
50      */

51
52     public String JavaDoc getURL(String JavaDoc anchor, boolean includeParameters);
53
54     /**
55      * Returns the absolute URL as a String, using default scheme, server and port, including
56      * parameters, and no anchor.
57      */

58
59     public String JavaDoc getAbsoluteURL();
60
61     /**
62      * Returns the absolute URL as a String.
63      *
64      * @param scheme
65      * if not null, overrides the default scheme.
66      * @param server
67      * if not null, overrides the default server
68      * @param port
69      * if non-zero, overrides the default port
70      * @param anchor
71      * if not null, appended to the URL
72      * @param includeParameters
73      * if true, parameters are included
74      */

75
76     public String JavaDoc getAbsoluteURL(String JavaDoc scheme, String JavaDoc server, int port, String JavaDoc anchor,
77             boolean includeParameters);
78
79     /**
80      * Returns an array of parameters names (in no alphabetical order).
81      *
82      * @see #getParameterValues(String)
83      */

84
85     public String JavaDoc[] getParameterNames();
86
87     /**
88      * Returns the values for the named parameter. Will return null if the no value is defined for
89      * the parameter.
90      */

91
92     public String JavaDoc[] getParameterValues(String JavaDoc name);
93 }
Popular Tags