Package com.adobe.marketing.mobile.util
Class URLBuilder
-
- All Implemented Interfaces:
public class URLBuilderA class providing a better way to construct a url.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public enumURLBuilder.EncodeType
-
Constructor Summary
Constructors Constructor Description URLBuilder()constructor
-
Method Summary
Modifier and Type Method Description URLBuilderenableSSL(boolean sslEnabled)set whether SSL is enabled URLBuilderaddPath(String newPath)add path to the url, should not include '/' in the string URLBuilderaddQueryParameters(Map<String, String> parameters)add multiple query parameters URLBuilderaddQueryParameter(String key, String value)add one query parameter with key/value pair, both key and value will be encoded URLBuilderaddQuery(String newQuery)add a whole string as a query in the url, the string will be encoded URLBuilderaddQuery(String newQuery, URLBuilder.EncodeType encodeType)add a whole string as a query in the url Stringbuild()build the url string based on all the data provided before URLBuildersetServer(String server)set the server address -
-
Method Detail
-
enableSSL
URLBuilder enableSSL(boolean sslEnabled)
set whether SSL is enabled
- Parameters:
sslEnabled- the boolean flag to indicated whether SSL is enabled- Returns:
this
-
addPath
URLBuilder addPath(String newPath)
add path to the url, should not include '/' in the string
- Parameters:
newPath- path string without '/'- Returns:
this
-
addQueryParameters
URLBuilder addQueryParameters(Map<String, String> parameters)
add multiple query parameters
- Parameters:
parameters- the map containing query parameters- Returns:
this
-
addQueryParameter
URLBuilder addQueryParameter(String key, String value)
add one query parameter with key/value pair, both key and value will be encoded
- Parameters:
key- the key of the query parametervalue- the value of the query parameter- Returns:
this
-
addQuery
URLBuilder addQuery(String newQuery)
add a whole string as a query in the url, the string will be encoded
- Parameters:
newQuery- the query string to be added to the url- Returns:
this
-
addQuery
URLBuilder addQuery(String newQuery, URLBuilder.EncodeType encodeType)
add a whole string as a query in the url
- Parameters:
newQuery- the query string to be added to the urlencodeType- encode type to be used to encode the query- Returns:
this
-
build
String build()
build the url string based on all the data provided before
- Returns:
the url string
-
setServer
URLBuilder setServer(String server)
set the server address
- Parameters:
server- server address- Returns:
this
-
-
-
-