View Javadoc

1   /*
2    * Copyright 2003,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  /*
17   * This source code implements specifications defined by the Java
18   * Community Process. In order to remain compliant with the specification
19   * DO NOT add / change / or delete method signatures!
20   */
21  package javax.portlet;
22  
23  
24  /***
25   * The <CODE>PortletResponse</CODE> defines the base interface to assist a
26   * portlet in creating and sending a response to the client.
27   * The portlet container uses two specialized versions of this interface
28   * when invoking a portlet, <CODE>ActionResponse</CODE> and
29   * <CODE>RenderResponse</CODE>. The  portlet container creates these
30   * objects and passes them as arguments to the portlet's <CODE>processAction</CODE>
31   * and <CODE>render</CODE> methods.
32   * 
33   * @see ActionResponse
34   * @see RenderResponse
35   */
36  public interface PortletResponse
37  {
38  
39  
40  
41    /***
42     * Adds a String property to an existing key to be returned to the portal.
43     * <p>
44     * This method allows response properties to have multiple values.
45     * <p>
46     * Properties can be used by portlets to provide vendor specific 
47     * information to the portal.
48     *
49     * @param  key    the key of the property to be returned to the portal
50     * @param  value  the value of the property to be returned to the portal
51     *
52     * @exception  java.lang.IllegalArgumentException 
53     *                            if key is <code>null</code>.
54     */
55  
56    public void addProperty(String key, String value);
57  
58  
59    /***
60     * Sets a String property to be returned to the portal.
61     * <p>
62     * Properties can be used by portlets to provide vendor specific 
63     * information to the portal.
64     * <p>
65     * This method resets all properties previously added with the same key.
66     *
67     * @param  key    the key of the property to be returned to the portal
68     * @param  value  the value of the property to be returned to the portal
69     *
70     * @exception  java.lang.IllegalArgumentException 
71     *                            if key is <code>null</code>.
72     */
73  
74    public void setProperty(String key, String value);
75  
76  
77    /***
78     * Returns the encoded URL of the resource, like servlets,
79     * JSPs, images and other static files, at the given path.
80     * <p>
81     * Some portal/portlet-container implementation may require 
82     * those URLs to contain implementation specific data encoded
83     * in it. Because of that, portlets should use this method to 
84     * create such URLs.
85     * <p>
86     * The <code>encodeURL</code> method may include the session ID 
87     * and other portal/portlet-container specific information into the URL. 
88     * If encoding is not needed, it returns the URL unchanged. 
89     *
90     * @param   path
91     *          the URI path to the resource. This must be either
92     *          an absolute URL (e.g. 
93     *          <code>http://my.co/myportal/mywebap/myfolder/myresource.gif</code>)
94     *          or a full path URI (e.g. <code>/myportal/mywebap/myfolder/myresource.gif</code>).
95     *
96     * @exception  java.lang.IllegalArgumentException 
97     *                            if path doesn't have a leading slash or is not an absolute URL
98     * 
99     * @return   the encoded resource URL as string
100    */
101 
102   public String encodeURL (String path);
103 
104 
105 
106 
107 
108 }
109 
110