com.atlassian.bamboo.util
Class UrlBuilder

java.lang.Object
  extended by com.atlassian.bamboo.util.UrlBuilder

public class UrlBuilder
extends java.lang.Object

From http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6306820

Given 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
UrlBuilder()
           
 
Method Summary
 UrlBuilder addParameter(java.lang.String name, java.lang.String value)
           
 UrlBuilder addParameters(java.util.Map newParams)
          Add parameters from a map
 UrlBuilder addPath(java.lang.String contextPath)
           
 java.lang.String getParameter(java.lang.String name)
          Returns the first item in the params list
 UrlBuilder removeParameter(java.lang.String name)
           
 UrlBuilder setParameter(java.lang.String name, java.lang.String value)
          Add a single parameter
 UrlBuilder setUrl(java.lang.String url)
           
 UrlBuilder setUrlBase(java.lang.String base)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UrlBuilder

public UrlBuilder()
Method Detail

setUrlBase

public UrlBuilder setUrlBase(java.lang.String base)

addPath

public UrlBuilder addPath(java.lang.String contextPath)

setUrl

public UrlBuilder setUrl(java.lang.String url)

addParameters

public UrlBuilder addParameters(java.util.Map newParams)
Add parameters from a map


setParameter

public UrlBuilder setParameter(java.lang.String name,
                               java.lang.String value)
Add a single parameter


addParameter

public UrlBuilder addParameter(java.lang.String name,
                               java.lang.String value)

removeParameter

public UrlBuilder removeParameter(java.lang.String name)

getParameter

public java.lang.String getParameter(java.lang.String name)
Returns the first item in the params list

Parameters:
name -
Returns:

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2012 Atlassian. All Rights Reserved.