|
Copyright © 2000, 2008, Oracle and/or its affiliates. All rights reserved. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.bea.netuix.util.PortletParameters
public class PortletParameters
Represents a set of parameters for a portlet.
This class exists to avoid repeatedly serializing and deserializing parameters from a string whenever possible, and to ensure consistent encoding and decoding of parameter names and values. This class is NOT internally synchronized.
Nested Class Summary | |
---|---|
static interface |
PortletParameters.ParameterFilter
Implementations of this interface are used to filter out or rename parameters when initially constructing a PortletParameters object. |
Constructor Summary | |
---|---|
PortletParameters()
Construct an empty PortletParameters |
|
PortletParameters(LinkedHashMap<String,List<String>> paramMap)
Constructs a new PortletParameters with the given parameter mapping. |
|
PortletParameters(PortletParameters params,
PortletParameters.ParameterFilter filter)
Constructs a new PortletParameters using the specified starting set and optional filter. |
|
PortletParameters(String queryString)
Construct a PortletParameters with the given initial parameter values. |
|
PortletParameters(String queryString,
PortletParameters.ParameterFilter filter,
String encoding)
Constructs a new PortletParameters using the specified query string and optional filter. |
Method Summary | |
---|---|
void |
append(String name,
List<String> additionalValues)
Appends the specified values to the parameter with the given name. |
void |
append(String name,
String[] additionalValues)
Appends the specified values to the parameter with the given name. |
void |
appendAll(Map<String,String[]> sourceMap)
Includes all parameters from the specified object into our own, appending any new values to existing values. |
void |
appendAll(PortletParameters other)
Includes all parameters from the specified object into our own, appending any new values to existing values. |
void |
appendFilteredParameters(Map<String,String[]> other,
PortletParameters.ParameterFilter filter)
Includes all parameters from the specified Map into this PortletParameters, after running through the specified filter to eliminate and / or rename parameters from the supplied PortletParameters. |
void |
appendFilteredParameters(PortletParameters other,
PortletParameters.ParameterFilter filter)
Includes all parameters from the specified PortletParameters into this PortletParameters, after running through the specified filter to eliminate and / or rename parameters from the supplied PortletParameters. |
void |
appendFilteredParametersMapList(Map<String,List<String>> other,
PortletParameters.ParameterFilter filter)
Includes all parameters from the specified Map into this PortletParameters, after running through the specified filter to eliminate and / or rename parameters from the supplied PortletParameters. |
void |
appendValue(String name,
String value)
Appends the specified value to the parameter with the given name. |
void |
clear()
Clears out the parameters |
static PortletParameters |
createPortletParameters(Map<String,List<String>> parameters)
Creates a new PortletParameters using the specified map. |
static PortletParameters |
createPortletParametersFromXmlEscapedQueryString(String escapedQueryString)
This method creates a PortletParameters object from a query string, first un-escaping any XML-escaped values for quote, apostrophe, ampersand, less-than and greater-than. |
String |
decode(String value)
URL-decodes the specified value using the encoding set on this PortletParameters object. |
String |
encode(String value)
URL-encodes the specified value using the encoding set on this PortletParameters object. |
boolean |
equals(Object o)
|
String |
getAsString()
Get a string representation (properly encoded) of the parameters |
String |
getAsString(PortletParameters.ParameterFilter filter)
Get a string representation (properly encoded) of the parameters |
String |
getFirstValue(String name)
Gets the first value for the specified parameter, if a value exists, otherwise null. |
LinkedHashMap<String,String[]> |
getParameterMap()
Returns a deep copy of the internal map of parameters, with values as a String array. |
LinkedHashMap<String,String[]> |
getParameterMap(PortletParameters.ParameterFilter filter)
Returns a deep copy of the internal map of parameters, with the specified filter applied, with values as a String array. |
LinkedHashMap<String,List<String>> |
getParameterMapList()
Returns a deep copy of the internal map of parameters, with values as a List of String |
LinkedHashMap<String,List<String>> |
getParameterMapList(PortletParameters.ParameterFilter filter)
Returns a deep copy of the internal map of parameters, with values as a List of String |
int |
getSize()
Returns the number of discreet mappings contained |
String[] |
getValues(String name)
Returns the set of values for the specified parameter |
boolean |
isEmpty()
Determines if this PortletParameters object contains any parameter mappings. |
Set<String> |
keySet()
|
boolean |
parameterValuesEqual(String paramName,
PortletParameters other)
Compares the values of the specified parameter in this PortletParameters object with the values of the same parameter in the supplied PortletParameters object, returning true only if all values are the same and
in the same order. |
static LinkedHashMap<String,List<String>> |
parseQueryString(String queryString,
String encoding,
PortletParameters.ParameterFilter filter)
Parses a query string into a map, using the specified encoding and optional parameter filter. |
void |
put(String name,
List<String> value)
Puts the specified parameter mapping in, replacing any previous values |
void |
put(String name,
String value)
|
void |
put(String name,
String[] value)
Puts the specified parameter mapping in, replacing any previous values |
void |
remove(String name)
|
void |
setEncoding(String encoding)
Sets the encoding |
void |
setFromString(String params)
Sets ALL values from the given string, wiping out all previous settings |
String |
toString()
|
static String |
xmlDecode(String escapedString)
Utility method for decoding XML escape sequences for less-than, greater-than, ampersand, quote and apostrophe. |
static String |
xmlEncode(String arg)
Utility method for encoding XML escape sequences for less-than, greater-than, ampersand, quote and apostrophe. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public PortletParameters(String queryString)
queryString
- the query string to usepublic PortletParameters()
public PortletParameters(LinkedHashMap<String,List<String>> paramMap)
public PortletParameters(String queryString, PortletParameters.ParameterFilter filter, String encoding)
queryString
- the query string to parseencoding
- the encoding to usefilter
- the parameter filter to use when constructing this object, which can
rename parameters or eliminate them from the resulting map.public PortletParameters(PortletParameters params, PortletParameters.ParameterFilter filter)
params
- the starting set of parametersfilter
- the parameter filter to use when constructing this object,
which can rename parameters or eliminate them from the original set.Method Detail |
---|
public static PortletParameters createPortletParametersFromXmlEscapedQueryString(String escapedQueryString)
escapedQueryString
- a string with ampersands escaped as "&"
to create the portlet parameters from. If null, it is treated the same as
an empty query string.public static PortletParameters createPortletParameters(Map<String,List<String>> parameters)
parameters
- the parameters to create the PortletParameters object from. If
null
, it is treated the same as an empty map. If there are keys
in the map which have null values, the key is ignored. If a key has an empty
list as a value, it is included in the resulting PortletParameters with no values.public static String xmlDecode(String escapedString)
escapedString
- the string to decode.
public static String xmlEncode(String arg)
arg
- the string to be encoded.
public void setEncoding(String encoding)
public boolean isEmpty()
true
if this PortletParameters contains no parameter mappings
at all, false
otherwise.public String getAsString()
public String getAsString(PortletParameters.ParameterFilter filter)
public String encode(String value)
public String decode(String value)
public void setFromString(String params)
public void put(String name, List<String> value)
public void put(String name, String[] value)
public void put(String name, String value)
public String getFirstValue(String name)
public String[] getValues(String name)
public boolean parameterValuesEqual(String paramName, PortletParameters other)
true
only if all values are the same and
in the same order.
paramName
- the name of the parameter to compareother
- the other PortletParameters object to compare the parameter values with
true
if all values are the same for the specified parameter
in this PortletParemeters object and the supplied PortletParameters object.public void appendAll(PortletParameters other)
public void appendFilteredParameters(PortletParameters other, PortletParameters.ParameterFilter filter)
public void appendFilteredParameters(Map<String,String[]> other, PortletParameters.ParameterFilter filter)
public void appendFilteredParametersMapList(Map<String,List<String>> other, PortletParameters.ParameterFilter filter)
public void appendAll(Map<String,String[]> sourceMap)
public void append(String name, List<String> additionalValues)
public void append(String name, String[] additionalValues)
public void appendValue(String name, String value)
public void clear()
public LinkedHashMap<String,String[]> getParameterMap()
public LinkedHashMap<String,String[]> getParameterMap(PortletParameters.ParameterFilter filter)
filter
- the filter to use in renaming / removing parameters when
creating the map, or null
if no filter should be used.public LinkedHashMap<String,List<String>> getParameterMapList()
public LinkedHashMap<String,List<String>> getParameterMapList(PortletParameters.ParameterFilter filter)
filter
- the filter to use in renaming / removing parameters when
creating the map, or null
if no filter should be used.public Set<String> keySet()
public void remove(String name)
public int getSize()
public String toString()
toString
in class Object
public boolean equals(Object o)
equals
in class Object
public static LinkedHashMap<String,List<String>> parseQueryString(String queryString, String encoding, PortletParameters.ParameterFilter filter)
queryString
- the query string to parse, cannot be null
encoding
- the encoding to use, cannot be null
filter
- the parameter filter to use when constructing the map, which can
rename parameters or eliminate them from the resulting map.
|
Copyright © 2000, 2008, Oracle and/or its affiliates. All rights reserved. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |