Package com.atlassian.bamboo.util
Class UrlBuilder
- java.lang.Object
-
- com.atlassian.bamboo.util.UrlBuilder
-
public class UrlBuilder extends Object
From http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6306820Given a URL and a set of parameters, provide abilites to add and remove parameters (either directly, from a Map, or from a Bean), and finally reconstruct the proper URL. For example:
UrlBuilder builder = new UrlBuilder() .setUrl( strUrl )) .addParameters( p_request.getParameterMap() ); .removeParameter( "id" ) .addParameter( "session", strSession );
Note that this class currently does not support URL rewriting of cookie strings (though it should).
-
-
Constructor Summary
Constructors Constructor Description UrlBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description UrlBuilder
addParameter(String name, Number value)
UrlBuilder
addParameter(String name, String value)
UrlBuilder
addParameters(Map<String,Object> newParams)
Add parameters from a mapUrlBuilder
addPath(String contextPath)
String
getParameter(String name)
Returns the first item in the params listUrlBuilder
removeParameter(String name)
UrlBuilder
setParameter(String name, String value)
Add a single parameterUrlBuilder
setUrl(String url)
UrlBuilder
setUrlBase(String base)
UrlBuilder
setUrlBase(URL url)
String
toString()
-
-
-
Method Detail
-
setUrlBase
public UrlBuilder setUrlBase(String base)
-
setUrlBase
public UrlBuilder setUrlBase(URL url)
-
addPath
public UrlBuilder addPath(String contextPath)
-
setUrl
public UrlBuilder setUrl(String url)
-
addParameters
public UrlBuilder addParameters(Map<String,Object> newParams)
Add parameters from a map
-
setParameter
public UrlBuilder setParameter(String name, String value)
Add a single parameter
-
addParameter
public UrlBuilder addParameter(String name, String value)
-
addParameter
public UrlBuilder addParameter(String name, Number value)
-
removeParameter
public UrlBuilder removeParameter(String name)
-
getParameter
public String getParameter(String name)
Returns the first item in the params list- Parameters:
name
-- Returns:
-
-