001 /** 002 * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. 003 * 004 * This library is free software; you can redistribute it and/or modify it under 005 * the terms of the GNU Lesser General Public License as published by the Free 006 * Software Foundation; either version 2.1 of the License, or (at your option) 007 * any later version. 008 * 009 * This library is distributed in the hope that it will be useful, but WITHOUT 010 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 011 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 012 * details. 013 */ 014 015 package com.liferay.portal.kernel.portlet; 016 017 import java.io.Serializable; 018 019 import java.util.Map; 020 import java.util.Set; 021 022 import javax.portlet.PortletURL; 023 import javax.portlet.ResourceURL; 024 025 /** 026 * Represents a URL pointing to a portlet. 027 * 028 * @author Brian Wing Shun Chan 029 * @see com.liferay.portlet.PortletURLImpl 030 */ 031 public interface LiferayPortletURL 032 extends PortletURL, ResourceURL, Serializable { 033 034 /** 035 * Adds a parameter that is included in the friendly URL path and does not 036 * need to appear in the query string. 037 * 038 * @param name the name of the parameter 039 */ 040 public void addParameterIncludedInPath(String name); 041 042 /** 043 * Returns the portlet lifecycle of this URL's target portlet. 044 * 045 * @return the portlet lifecycle of this URL's target portlet 046 * @see #setLifecycle(String) 047 */ 048 public String getLifecycle(); 049 050 /** 051 * Returns the first value of the URL parameter. 052 * 053 * @param name the name of the URL parameter 054 * @return the first value of the URL parameter 055 */ 056 public String getParameter(String name); 057 058 /** 059 * Returns the parameters that are included in the friendly URL path and do 060 * not need to appear in the query string. 061 * 062 * @return the names of the parameters that are included in the friendly URL 063 * path and do not need to appear in the query string 064 */ 065 public Set<String> getParametersIncludedInPath(); 066 067 /** 068 * Returns the ID of this URL's target portlet. 069 * 070 * @return the ID of this URL's target portlet 071 */ 072 public String getPortletId(); 073 074 public Set<String> getRemovedParameterNames(); 075 076 /** 077 * Returns the map of reserved parameters for this URL. 078 * 079 * <p> 080 * This method is only used internally. Reserved parameters contain special, 081 * Liferay specific information, such as <code>p_p_id</code> and 082 * <code>p_p_lifecycle</code>. 083 * </p> 084 * 085 * @return the reserved parameter names and values in a read-only map 086 */ 087 public Map<String, String> getReservedParameterMap(); 088 089 /** 090 * Returns the ID of this URL's target resource. 091 * 092 * @return the ID of this URL's target resource 093 */ 094 public String getResourceID(); 095 096 /** 097 * Returns <code>true</code> if this URL is an anchor pointing to the 098 * specified portlet on the page. 099 * 100 * @return whether this URL is an anchor pointing to the specified portlet 101 * on the page 102 * @see #setAnchor(boolean) 103 */ 104 public boolean isAnchor(); 105 106 /** 107 * Returns <code>true</code> if the render parameters in the current request 108 * should be copied to this URL. 109 * 110 * @return whether the render parameters in the current request should be 111 * copied to this URL 112 * @see #setCopyCurrentRenderParameters(boolean) 113 */ 114 public boolean isCopyCurrentRenderParameters(); 115 116 /** 117 * Returns <code>true</code> if this URL should be encrypted. 118 * 119 * @return <code>true</code> if this URL should be encrypted; 120 * <code>false</code> otherwise 121 * @see #setEncrypt(boolean) 122 */ 123 public boolean isEncrypt(); 124 125 /** 126 * Returns <code>true</code> if this URL should be XML escaped. 127 * 128 * @return <code>true</code> if this URL should be XML escaped; 129 * <code>false</code> otherwise 130 * @see #setEscapeXml(boolean) 131 */ 132 public boolean isEscapeXml(); 133 134 /** 135 * Returns <code>true</code> if the parameter is included in the friendly 136 * URL path. 137 * 138 * @param name the name of the parameter to check for inclusion in the path 139 * @return whether the parameter is included in the friendly URL path 140 * @see #addParameterIncludedInPath(String) 141 */ 142 public boolean isParameterIncludedInPath(String name); 143 144 /** 145 * Returns <code>true</code> if this URL is secure (https). 146 * 147 * @return <code>true</code> if this URL is secure; <code>false</code> 148 * otherwise 149 */ 150 public boolean isSecure(); 151 152 /** 153 * Sets whether this URL is an anchor pointing to the specified portlet on 154 * the page. 155 * 156 * <p> 157 * An anchor URL will cause the user's browser to automatically jump down to 158 * the specified portlet after the page loads, avoiding the need to scroll. 159 * </p> 160 * 161 * @param anchor whether this URL is an anchor pointing to the specified 162 * portlet on the page 163 */ 164 public void setAnchor(boolean anchor); 165 166 public void setControlPanelCategory(String controlPanelCategory); 167 168 /** 169 * Sets whether the render parameters in the current request should be 170 * copied to this URL. 171 * 172 * <p> 173 * New parameters set on this URL will appear before the copied render 174 * parameters. 175 * </p> 176 * 177 * @param copyCurrentRenderParameters whether the render parameters in the 178 * current request should be copied to this URL 179 */ 180 public void setCopyCurrentRenderParameters( 181 boolean copyCurrentRenderParameters); 182 183 public void setDoAsGroupId(long doAsGroupId); 184 185 /** 186 * Sets the ID of the user to impersonate. 187 * 188 * <p> 189 * When a page is accessed while impersonating a user, it will appear 190 * exactly as it would to that user. 191 * </p> 192 * 193 * @param doAsUserId the ID of the user to impersonate in the portlet this 194 * URL points to 195 */ 196 public void setDoAsUserId(long doAsUserId); 197 198 /** 199 * Sets the language ID of the user to impersonate. This will only have an 200 * effect when a user is being impersonated via {@link 201 * #setDoAsUserId(long)}. 202 * 203 * <p> 204 * The language set here will override the impersonated user's default 205 * language. 206 * </p> 207 * 208 * @param doAsUserLanguageId the language ID of the user to impersonate 209 */ 210 public void setDoAsUserLanguageId(String doAsUserLanguageId); 211 212 /** 213 * Sets whether this URL should be encrypted. 214 * 215 * <p> 216 * In an encrypted URL, the value of every parameter will be encrypted using 217 * the company's key. This allows sensitive information to be placed in the 218 * URL without being vulnerable to snooping. 219 * </p> 220 * 221 * <p> 222 * Note that this is not the same as making a URL {@link #setSecure(boolean) 223 * secure}. 224 * </p> 225 */ 226 public void setEncrypt(boolean encrypt); 227 228 /** 229 * Sets whether this URL should be XML escaped. 230 * 231 * <p> 232 * If a URL is XML escaped, it will automatically have special characters 233 * escaped when it is converted to a string or written to a {@link 234 * java.io.Writer}. 235 * </p> 236 * 237 * @param escapeXml whether this URL should be XML escaped 238 */ 239 public void setEscapeXml(boolean escapeXml); 240 241 /** 242 * Sets the portlet lifecycle of this URL's target portlet. 243 * 244 * <p> 245 * Valid lifecycles are: 246 * </p> 247 * 248 * <ul> 249 * <li> 250 * {@link javax.portlet.PortletRequest#ACTION_PHASE} 251 * </li> 252 * <li> 253 * {@link javax.portlet.PortletRequest#RENDER_PHASE} 254 * </li> 255 * <li> 256 * {@link javax.portlet.PortletRequest#RESOURCE_PHASE} 257 * </li> 258 * </ul> 259 * 260 * @param lifecycle the portlet lifecycle 261 */ 262 public void setLifecycle(String lifecycle); 263 264 /** 265 * Sets the URL parameter to the value. 266 * 267 * @param name the name of the URL parameter 268 * @param value the value of the URL parameter 269 * @param append whether the new value should be appended to any existing 270 * values for the parameter. If <code>append</code> is 271 * <code>false</code> any existing values will be overwritten with 272 * the new value. 273 */ 274 public void setParameter(String name, String value, boolean append); 275 276 /** 277 * Sets the URL parameter the values. 278 * 279 * @param name the name of the URL parameter 280 * @param values the values of the URL parameter 281 * @param append whether the new values should be appended to any existing 282 * values for the parameter. If <code>append</code> is 283 * <code>false</code> any existing values will be overwritten with 284 * the new values. 285 */ 286 public void setParameter(String name, String[] values, boolean append); 287 288 /** 289 * Sets the portlet layout ID. 290 * 291 * @param plid the portlet layout ID 292 */ 293 public void setPlid(long plid); 294 295 /** 296 * Sets the ID of the target portlet. 297 */ 298 public void setPortletId(String portletId); 299 300 /** 301 * Sets the referer layout ID. 302 * 303 * @param refererPlid the referer layout ID 304 */ 305 public void setRefererPlid(long refererPlid); 306 307 public void setRemovedParameterNames(Set<String> removedParamNames); 308 309 }