net.sf.gsaapi.util
Class QueryStringFilter
java.lang.Object
net.sf.gsaapi.util.QueryStringFilter
- public class QueryStringFilter
- extends java.lang.Object
This is a simple utility to manipulate url query strings.
By specifying an array of url parameter names, this
class allows you to use the filter method to strip out
any other parameter names/values from an arbitrary
query string.
String[] retainThese = new String[]{"param1", "param3"};
QueryStringFilter qsf = new QueryStringFilter(retainThese);
System.out.println(qsf.filter("param1=value1¶m2=value2¶m3=value3¶m4=value4"));
The above code will print out: "param1=value1¶m3=value3"
In general, the order of the parameters is not guaranteed.
- Author:
- Amol S Deshmukh adeshmuk .at inxight .dot com
Constructor Summary |
QueryStringFilter(java.lang.String[] retainedParams)
Constructor specifying the array of Strings
representing the params that should be
retained when filtering. |
Method Summary |
java.lang.String |
filter(java.lang.String queryString)
Returns the filtered queryString (Thus, only the params specified
in the constructor are retained and other params are stripped
out of the query string) |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
QueryStringFilter
public QueryStringFilter(java.lang.String[] retainedParams)
- Constructor specifying the array of Strings
representing the params that should be
retained when filtering.
- Parameters:
retainedParams
-
filter
public java.lang.String filter(java.lang.String queryString)
- Returns the filtered queryString (Thus, only the params specified
in the constructor are retained and other params are stripped
out of the query string)
- Parameters:
queryString
-
- Returns:
- the filtered HTTP queryString
© Copyright 2006 Inxight Software, Inc.