1 /* ==================================================================== 2 * The Apache Software License, Version 1.1 3 * 4 * Copyright (c) 2000-2001 The Apache Software Foundation. All rights 5 * reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 11 * 1. Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * 14 * 2. Redistributions in binary form must reproduce the above copyright 15 * notice, this list of conditions and the following disclaimer in 16 * the documentation and/or other materials provided with the 17 * distribution. 18 * 19 * 3. The end-user documentation included with the redistribution, 20 * if any, must include the following acknowledgment: 21 * "This product includes software developed by the 22 * Apache Software Foundation (http://www.apache.org/)." 23 * Alternately, this acknowledgment may appear in the software itself, 24 * if and wherever such third-party acknowledgments normally appear. 25 * 26 * 4. The names "Apache" and "Apache Software Foundation" and 27 * "Apache Jetspeed" must not be used to endorse or promote products 28 * derived from this software without prior written permission. For 29 * written permission, please contact apache@apache.org. 30 * 31 * 5. Products derived from this software may not be called "Apache" or 32 * "Apache Jetspeed", nor may "Apache" appear in their name, without 33 * prior written permission of the Apache Software Foundation. 34 * 35 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 36 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 37 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 38 * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR 39 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 40 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 41 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 42 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 43 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 44 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 45 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 46 * SUCH DAMAGE. 47 * ==================================================================== 48 * 49 * This software consists of voluntary contributions made by many 50 * individuals on behalf of the Apache Software Foundation. For more 51 * information on the Apache Software Foundation, please see 52 * <http://www.apache.org/>. 53 */ 54 55 package org.apache.jetspeed.portlet; 56 57 import org.apache.jetspeed.portlet.event.ActionListener; 58 59 /** 60 * A <CODE>PortletURI</CODE> represents a URI to a specific portlet 61 * function. A URI is created through the <CODE>PortletResponse</CODE> 62 * for a specific portlet mode. Then additional parameter can be 63 * added to the URI. The complete URI can be converted to a string 64 * which is ready for embedding into markup. 65 * 66 * <P> 67 * On top of the parameters, it is possible to add actions to a 68 * portlet URI. Actions are portlet-specific activities that need to 69 * be performed as result of the incoming request, but before the 70 * <CODE>service()</CODE> method of the portlet is called. For example, 71 * the PERSONALIZE mode of the portlet is likely to have a "Save" 72 * button at the end of its dialog. The "Save" button has to bring 73 * the user back to the DEFAULT mode of the portlet, but to save the 74 * personalized portlet data, the portlet needs to be able to process 75 * the posted data bfore the next markup is generated. This can be 76 * achieved by adding a "Save" action to the URI that represents the 77 * "Save" button. The respective listener is attached the respective 78 * action listener to the portlet response. This listener will be 79 * called when the next request comes and one of the portlet URIs 80 * where the reason for the request. If more than one URI were part 81 * of the response, the listener need to the check the action content. 82 * This depends on the definition of the actual action which is the 83 * responsibility of the portlet developer. 84 * </P> 85 * 86 * @author <A HREF="mailto:tboehme@us.ibm.com">Thomas F. Boehme</A> 87 */ 88 public interface PortletURI 89 { 90 /** 91 ** Adds the given parameter to this URI. A portlet container 92 ** may wish to prefix the attribute names internally, to preserve 93 ** a unique namespace for the portlet. 94 ** 95 ** @param name 96 ** the parameter name 97 ** @param value 98 ** the parameter value 99 **/ 100 101 public void addParameter (String name, String value); 102 103 /** 104 * Adds the given action to this URI. The action is a 105 * portlet-defined implementation of the portlet action interface. 106 * It can carry any information. How the information is recovered 107 * should the next request be for this URI is at the discretion of 108 * the portlet container. 109 * 110 * <P> 111 * Unless an action listener is registered in the portlet descriptor 112 * this action will not be delivered. 113 * </P> 114 * 115 * @param action 116 * the portlet action 117 */ 118 public void addAction (PortletAction action); 119 120 /** 121 ** Returns the complete URI as a string. 122 ** The string is ready to be embedded in markup. 123 ** 124 ** <P> 125 ** Once the string has been created, adding more parameters 126 ** or other listeners will not modify the string. You have to 127 ** call this method again, to create an updated string. 128 ** 129 ** @return the encoded URI as a string 130 **/ 131 132 public String toString (); 133 }