public class BaseURLWrapper extends RenderStateWrapper implements BaseURL
BaseURLWrapper provides a convenient
implementation of the BaseURL interface
that can be subclassed by developers.
This class implements the Wrapper or Decorator pattern.
Methods default to calling through to the wrapped object.
wrapped| Constructor and Description |
|---|
BaseURLWrapper(BaseURL wrapped) |
| Modifier and Type | Method and Description |
|---|---|
void |
addProperty(String key,
String value)
Adds a String property to an existing key on the URL.
|
Appendable |
append(Appendable out)
Appends the portlet URL to the appendable object.
|
Appendable |
append(Appendable out,
boolean escapeXML)
Appends the portlet URL to the appendable object.
|
Map<String,String[]> |
getParameterMap()
Deprecated.
|
BaseURL |
getWrapped()
Gets the wrapped object.
|
void |
setParameter(String name,
String... values)
Deprecated.
|
void |
setParameter(String name,
String value)
Deprecated.
|
void |
setParameters(Map<String,String[]> parameters)
Deprecated.
|
void |
setProperty(String key,
String value)
Sets a String property on the URL.
|
void |
setSecure(boolean secure)
Indicates the security setting for this URL.
|
void |
setWrapped(BaseURL wrapped)
Sets the wrapped object.
|
String |
toString()
Returns the portlet URL string representation to be embedded in the
markup.
Note that the returned String may not be a valid URL, as it may be rewritten by the portal/portlet-container before returning the markup to the client. |
void |
write(Writer out)
Writes the portlet URL to the output stream using the provided writer.
|
void |
write(Writer out,
boolean escapeXML)
Writes the portlet URL to the output stream using the provided writer.
|
getPortletMode, getRenderParameters, getWindowState, setWrappedclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetPortletMode, getRenderParameters, getWindowStatepublic BaseURLWrapper(BaseURL wrapped)
wrapped - the wrapped object to set.IllegalArgumentException - if the BaseURL is null.public BaseURL getWrapped()
getWrapped in class RenderStateWrapperpublic void setWrapped(BaseURL wrapped)
wrapped - the wrapped object to set.IllegalArgumentException - if the BaseURL is null.@Deprecated public void setParameter(String name, String value)
BaseURLThis method replaces all parameter values with the given key, as allowed according to the rules for the URL.
RenderURL - Both public and private parameters can be set.
ActionURL - Action parameters (private parameters) are set as described.
Public render parameters
remain unchanged. If an action parameter has the same name as a public
render parameter, both the action parameter value and the public render parameter
value will be available during processing of the action request.
ResourceURL - Resource parameters are set. Public
and private render parameters that were attached to the URL when it was created
remain unchanged.
If a resource parameter has the same name as a public or private
render parameter, both the resource parameter value and the public or private
render parameter value will be available during processing of the resource request.
The PortletURL implementation 'x-www-form-urlencoded' encodes
all parameter names and values. Developers should not encode them.
A portlet container may prefix the attribute names internally in order to preserve a unique namespace for the portlet.
A parameter value of null indicates that this
parameter should be removed.
However, an empty string value ("") is allowed.
A public render parameter cannot be removed by
setting its value to null.
setParameter in interface BaseURLname - the parameter namevalue - the parameter value@Deprecated public void setParameter(String name, String... values)
BaseURLThis method replaces all parameter values with the given key according to the rules for the URL.
RenderURL - Both public and private parameters can be set.
ActionURL - Action parameters (private parameters) are set as described.
Public render parameters
remain unchanged. If an action parameter has the same name as a public
render parameter, both the action parameter value and the public render parameter
value will be available during processing of the action request.
ResourceURL - Resource parameters are set. Public
and private render parameters that were attached to the URL when it was created
remain unchanged.
If a resource parameter has the same name as a public or private
render parameter, both the resource parameter value and the public or private
render parameter value will be available during processing of the resource request.
The PortletURL implementation 'x-www-form-urlencoded' encodes
all parameter names and values. Developers should not encode them.
A portlet container may prefix the attribute names internally in order to preserve a unique namespace for the portlet.
A values parameter of null indicates that this
parameter should be removed.
If the values parameter is not null, no element of the values array may be null. However, an empty string value ("") is allowed.
setParameter in interface BaseURLname - the parameter namevalues - the parameter values@Deprecated public void setParameters(Map<String,String[]> parameters)
BaseURLAll previously set parameters are cleared.
This method can be used to set both public and private render parameters according to the rules for the URL.
RenderURL - Both public and private parameters can be set.
ActionURL - Action parameters are set. Public render parameters
remain unchanged. If an action parameter has the same name as a public
render parameter, both the action parameter value and the public render parameter
value will be available during processing of the action request.
ResourceURL - Resource parameters are set. Public
and private render parameters that were attached to the URL when it was created
remain unchanged.
If a resource parameter has the same name as a public or private
render parameter, both the resource parameter value and the public or private
render parameter value will be available during processing of the resource request.
These parameters will be accessible through the portlet request initiated through the URL.
Any previously set private render parameter that is not contained in the new map is removed. However, public render parameters cannot be removed by excluding them from the map. Public render parameters that are not included in the map remain unchanged.
The PortletURL implementation 'x-www-form-urlencoded' encodes
all parameter names and values. Developers should not encode them.
A portlet container may prefix the attribute names internally, in order to preserve a unique namespace for the portlet.
setParameters in interface BaseURLparameters -
Map containing parameter names for the render phase as keys and
parameter values as map values. The keys in the parameter map must be of type
String and may not be null or the empty string (""). The values in the parameter
map must be of type String array (String[]).
Neither the values array nor any of
its elements may be null; however, the empty string ("") is allowed as an array element.
public void setSecure(boolean secure)
throws PortletSecurityException
BaseURL
Secure set to true indicates that the portlet requests
a secure connection between the client and the portlet window for
this URL. Secure set to false indicates that the portlet
does not need a secure connection for this URL. If the security is not
set for a URL, it should stay the same as the current request.
setSecure in interface BaseURLsecure - true, if portlet requests to have a secure connection
between its portlet window and the client; false, if
the portlet does not require a secure connection.PortletSecurityException - if the run-time environment does
not support the indicated setting@Deprecated public Map<String,String[]> getParameterMap()
BaseURLMap of the parameters currently set on this portlet
URL.
The values in the returned Map are from type
String array (String[]).
The contents of the returned map are immutable in the sense that modifying the map
does not directly affect the render parameters. In order to set the
parameters using the modified map,
the BaseURL.setParameters(Map) method must be used.
If no parameters exist this method returns an empty Map.
getParameterMap in interface BaseURLMap containing parameter names as
keys and parameter values as map values, or an empty Map
if no parameters exist. The keys in the parameter
map are of type String. The values in the parameter map are of type
String array (String[]).public void write(Writer out) throws IOException
BaseURLNote that the URL written to the output stream may not be a valid URL, as it may be rewritten by the portal/portlet-container before returning the markup to the client.
The URL written to the output stream is always XML escaped. For writing
non-escaped URLs use BaseURL.write(java.io.Writer, boolean).
write in interface BaseURLout - the writer to write the portlet URL toIOException - if an I/O error occurred while writing the URLpublic void write(Writer out, boolean escapeXML) throws IOException
BaseURLescapeXML is set to false, escaping the URL is
left to the implementation.
Note that the URL written to the output stream may not be a valid URL, as it may be rewritten by the portal/portlet-container before returning the markup to the client.
write in interface BaseURLout - the writer to write the portlet URL toescapeXML - denotes if the URL should be XML escaped before written to the output
stream or notIOException - if an I/O error occurred while writing the URLpublic Appendable append(Appendable out) throws IOException
BaseURLNote that the appended URL may not be a valid URL, as it may be rewritten by the portal/portlet-container before returning the markup to the client.
The appended URL is always XML escaped. For appending
non-escaped URLs use BaseURL.append(java.lang.Appendable, boolean).
append in interface BaseURLout - the object to receive the URLIOException - if an I/O error occurred while writing the URLpublic Appendable append(Appendable out, boolean escapeXML) throws IOException
BaseURL
If the parameter escapeXML is set to true, the URL will be escaped to be
valid XML characters.
The manner in which escaping is performed is
implementation specific.
If escapeXML is set to false, escaping the URL is
left to the implementation.
Note that the appended URL may not be a valid URL, as it may be rewritten by the portal/portlet-container before returning the markup to the client.
append in interface BaseURLout - the object to receive the URLIOException - if an I/O error occurred while writing the URLpublic void addProperty(String key, String value)
BaseURLThis method allows URL properties to have multiple values.
Properties can be used by portlets to provide vendor specific information to the URL.
addProperty in interface BaseURLkey - the key of the propertyvalue - the value of the propertypublic void setProperty(String key, String value)
BaseURLProperties can be used by portlets to provide vendor specific information to the URL.
This method resets all properties previously added with the same key.
setProperty in interface BaseURLkey - the key of the propertyvalue - the value of the propertypublic String toString()
BaseURLThe returned URL is not XML escaped.
For writing URLs to an output stream the BaseURL.write(java.io.Writer) or
BaseURL.write(java.io.Writer, boolean) method should be used as these are
more efficient.
Java Portlet 3.0 API Specification. See the Copyright and License provided with this distribution. Use is subject to license terms.