001 /** 002 * Copyright (c) 2000-present 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 public long getPlid(); 068 069 /** 070 * Returns the ID of this URL's target portlet. 071 * 072 * @return the ID of this URL's target portlet 073 */ 074 public String getPortletId(); 075 076 public Set<String> getRemovedParameterNames(); 077 078 /** 079 * Returns the map of reserved parameters for this URL. 080 * 081 * <p> 082 * This method is only used internally. Reserved parameters contain special, 083 * Liferay specific information, such as <code>p_p_id</code> and 084 * <code>p_p_lifecycle</code>. 085 * </p> 086 * 087 * @return the reserved parameter names and values in a read-only map 088 */ 089 public Map<String, String> getReservedParameterMap(); 090 091 /** 092 * Returns the ID of this URL's target resource. 093 * 094 * @return the ID of this URL's target resource 095 */ 096 public String getResourceID(); 097 098 /** 099 * Returns <code>true</code> if this URL is an anchor pointing to the 100 * specified portlet on the page. 101 * 102 * @return whether this URL is an anchor pointing to the specified portlet 103 * on the page 104 * @see #setAnchor(boolean) 105 */ 106 public boolean isAnchor(); 107 108 /** 109 * Returns <code>true</code> if the render parameters in the current request 110 * should be copied to this URL. 111 * 112 * @return whether the render parameters in the current request should be 113 * copied to this URL 114 * @see #setCopyCurrentRenderParameters(boolean) 115 */ 116 public boolean isCopyCurrentRenderParameters(); 117 118 /** 119 * Returns <code>true</code> if this URL should be encrypted. 120 * 121 * @return <code>true</code> if this URL should be encrypted; 122 * <code>false</code> otherwise 123 * @see #setEncrypt(boolean) 124 */ 125 public boolean isEncrypt(); 126 127 /** 128 * Returns <code>true</code> if this URL should be XML escaped. 129 * 130 * @return <code>true</code> if this URL should be XML escaped; 131 * <code>false</code> otherwise 132 * @see #setEscapeXml(boolean) 133 */ 134 public boolean isEscapeXml(); 135 136 /** 137 * Returns <code>true</code> if the parameter is included in the friendly 138 * URL path. 139 * 140 * @param name the name of the parameter to check for inclusion in the path 141 * @return whether the parameter is included in the friendly URL path 142 * @see #addParameterIncludedInPath(String) 143 */ 144 public boolean isParameterIncludedInPath(String name); 145 146 /** 147 * Returns <code>true</code> if this URL is secure (https). 148 * 149 * @return <code>true</code> if this URL is secure; <code>false</code> 150 * otherwise 151 */ 152 public boolean isSecure(); 153 154 /** 155 * Sets whether this URL is an anchor pointing to the specified portlet on 156 * the page. 157 * 158 * <p> 159 * An anchor URL will cause the user's browser to automatically jump down to 160 * the specified portlet after the page loads, avoiding the need to scroll. 161 * </p> 162 * 163 * @param anchor whether this URL is an anchor pointing to the specified 164 * portlet on the page 165 */ 166 public void setAnchor(boolean anchor); 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 public void setRefererGroupId(long refererGroupId); 301 302 /** 303 * Sets the referer layout ID. 304 * 305 * @param refererPlid the referer layout ID 306 */ 307 public void setRefererPlid(long refererPlid); 308 309 public void setRemovedParameterNames(Set<String> removedParamNames); 310 311 }