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