|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.onebusaway.presentation.client.UrlBuilder
public class UrlBuilder
Utility class to build a URL from components. TODO(jlabanca): Add a constructor that parses an existing URL Note that this class was copied verbatim from the com.google.gwt.http.client.URLBuilder in GWT, but modified to fix bugs with escaping (especially param values that included a & character)
Field Summary | |
---|---|
static int |
PORT_UNSPECIFIED
The port to use when no port should be specified. |
Constructor Summary | |
---|---|
UrlBuilder()
|
Method Summary | |
---|---|
String |
buildString()
Build the URL and return it as an encoded string. |
static UrlBuilder |
createFromLocation()
|
UrlBuilder |
removeParameter(String name)
Remove a query parameter from the map. |
UrlBuilder |
setHash(String hash)
Set the hash portion of the location (ex. |
UrlBuilder |
setHost(String host)
Set the host portion of the location (ex. |
UrlBuilder |
setParameter(String key,
String... values)
Set a query parameter to a list of values. |
UrlBuilder |
setPath(String path)
Set the path portion of the location (ex. |
UrlBuilder |
setPort(int port)
Set the port to connect to. |
UrlBuilder |
setProtocol(String protocol)
Set the protocol portion of the location (ex. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int PORT_UNSPECIFIED
Constructor Detail |
---|
public UrlBuilder()
Method Detail |
---|
public static UrlBuilder createFromLocation()
public String buildString()
public UrlBuilder removeParameter(String name)
name
- the parameter namepublic UrlBuilder setHash(String hash)
hash
- the hashpublic UrlBuilder setHost(String host)
host
- the hostpublic UrlBuilder setParameter(String key, String... values)
Set a query parameter to a list of values. Each value in the list will be added as its own key/value pair.
?mykey=value0&mykey=value1&mykey=value2
key
- the keyvalues
- the list of valuespublic UrlBuilder setPath(String path)
path
- the pathpublic UrlBuilder setPort(int port)
port
- the port, or PORT_UNSPECIFIED
public UrlBuilder setProtocol(String protocol)
protocol
- the protocol
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |