rewrite-api-servlet 2.0.0.Beta2

org.ocpsoft.rewrite.servlet.util
Class QueryStringBuilder

java.lang.Object
  extended by org.ocpsoft.rewrite.servlet.util.QueryStringBuilder

Deprecated. Use AddressBuilder instead. May be removed in subsequent releases.

@Deprecated
public class QueryStringBuilder
extends Object

Utility for building URL query strings.

Author:
Lincoln Baxter, III

Constructor Summary
QueryStringBuilder()
          Deprecated.  
 
Method Summary
 void addParameter(String name, String... values)
          Deprecated. Add a single parameter with the given values.
 QueryStringBuilder addParameterArrays(Map<String,String[]> params)
          Deprecated. Add parameters from the given map of name=value pairs.
 QueryStringBuilder addParameterLists(Map<String,List<String>> params)
          Deprecated. Add parameters from the given map of name=value pairs.
 QueryStringBuilder addParameters(String url)
          Deprecated. Add parameters from the given URL.
static QueryStringBuilder createFromArrays(Map<String,String[]> params)
          Deprecated. Build a query string from the given map of name=value pairs.
static QueryStringBuilder createFromEncoded(String parameters)
          Deprecated. Build a query string from the given URL.
static QueryStringBuilder createFromLists(Map<String,List<String>> params)
          Deprecated. Build a query string from the given map of name=value pairs.
static QueryStringBuilder createNew()
          Deprecated. Return a new empty instance of QueryStringBuilder
 QueryStringBuilder decode()
          Deprecated. Return a new QueryStringBuilder instance having called URLDecoder.decode(String, String) on each name=value pair.
 QueryStringBuilder encode()
          Deprecated. Return a new QueryStringBuilder instance having called URLEncoder.encode(String, String) on each name=value pair.
static String extractQuery(String url)
          Deprecated. Get the query string portion of the given URL.
 String getParameter(String name)
          Deprecated. Get the first value of given parameter name.
 Map<String,List<String>> getParameterMap()
          Deprecated. Get the name, values[] map representing this query string.
 Set<String> getParameterNames()
          Deprecated. Get set of parameter names currently stored in this query string.
 String[] getParameterValues(String name)
          Deprecated. Get the array of values for a given parameter name.
 boolean isEmpty()
          Deprecated. Return true if this query string currently contains no parameters.
 List<String> removeParameter(String string)
          Deprecated.  
 String toQueryString()
          Deprecated. Convert the current parameters to a valid query string, including the leading '?' character.
 String toString()
          Deprecated.  
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

QueryStringBuilder

public QueryStringBuilder()
Deprecated. 
Method Detail

createNew

public static QueryStringBuilder createNew()
Deprecated. 
Return a new empty instance of QueryStringBuilder


createFromEncoded

public static QueryStringBuilder createFromEncoded(String parameters)
Deprecated. 
Build a query string from the given URL. If a '?' character is encountered in the URL, the any characters up to and including the first '?' will be ignored. This method assumes that the given parameters have already been URL encoded.


createFromArrays

public static QueryStringBuilder createFromArrays(Map<String,String[]> params)
Deprecated. 
Build a query string from the given map of name=value pairs. For parameters with more than one value, each value will be appended using the same name.


createFromLists

public static QueryStringBuilder createFromLists(Map<String,List<String>> params)
Deprecated. 
Build a query string from the given map of name=value pairs. For parameters with more than one value, each value will be appended using the same name.


extractQuery

public static String extractQuery(String url)
Deprecated. 
Get the query string portion of the given URL. If no query string separator character '?' can be found, return the string unchanged.


addParameters

public QueryStringBuilder addParameters(String url)
Deprecated. 
Add parameters from the given URL. If a '?' character is encountered in the URL, the any characters up to and including the first '?' will be ignored. If a parameter already exists, append new values to the existing list of values for that parameter.

Note: This method assumes that the given string is already URL encoded.


addParameter

public void addParameter(String name,
                         String... values)
Deprecated. 
Add a single parameter with the given values.


addParameterArrays

public QueryStringBuilder addParameterArrays(Map<String,String[]> params)
Deprecated. 
Add parameters from the given map of name=value pairs. For parameters with more than one value, each value will be appended using the same name. If a parameter already exists, append new values to the existing list of values for that parameter.


addParameterLists

public QueryStringBuilder addParameterLists(Map<String,List<String>> params)
Deprecated. 
Add parameters from the given map of name=value pairs. For parameters with more than one value, each value will be appended using the same name. If a parameter already exists, append new values to the existing list of values for that parameter.


decode

public QueryStringBuilder decode()
Deprecated. 
Return a new QueryStringBuilder instance having called URLDecoder.decode(String, String) on each name=value pair.


encode

public QueryStringBuilder encode()
Deprecated. 
Return a new QueryStringBuilder instance having called URLEncoder.encode(String, String) on each name=value pair.


getParameter

public String getParameter(String name)
Deprecated. 
Get the first value of given parameter name.

Returns:
The value of the parameter, null if the parameter does not exist, or "" if the parameter exists but has no values.

getParameterMap

public Map<String,List<String>> getParameterMap()
Deprecated. 
Get the name, values[] map representing this query string.


getParameterNames

public Set<String> getParameterNames()
Deprecated. 
Get set of parameter names currently stored in this query string.


getParameterValues

public String[] getParameterValues(String name)
Deprecated. 
Get the array of values for a given parameter name.

Returns:
The values of the parameter, null if the parameter does not exist.

isEmpty

public boolean isEmpty()
Deprecated. 
Return true if this query string currently contains no parameters.


removeParameter

public List<String> removeParameter(String string)
Deprecated. 

toQueryString

public String toQueryString()
Deprecated. 
Convert the current parameters to a valid query string, including the leading '?' character.

For example, a QueryStringBuilder with the values [key=>value, name=>value1,value2,value3] will become:

 
 ?key=value&name=value1&name=value2&name=value3
 

Returns:
If parameters exist, return a valid query string with leading '?' character. If no parameters exist, return an empty string.

toString

public String toString()
Deprecated. 
Overrides:
toString in class Object

rewrite-api-servlet 2.0.0.Beta2

Copyright © 2013 OCPsoft. All Rights Reserved.