public final class IotHubUri extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
API_VERSION
The API version will be passed as a param in the URI.
|
protected String |
hostname
The IoT Hub resource URI is the hostname and path component that is
common to all IoT Hub communication methods between the given device and
IoT Hub.
|
static Charset |
IOTHUB_URL_ENCODING_CHARSET
The charset used when URL-encoding the IoT Hub name and device ID.
|
protected String |
path |
static String |
PATH_FORMAT
The device ID and specific IoT Hub method path will be interpolated into
the path.
|
protected String |
uri |
| Modifier | Constructor and Description |
|---|---|
protected |
IotHubUri() |
|
IotHubUri(String iotHubHostname,
String deviceId,
String iotHubMethodPath)
Constructor.
|
|
IotHubUri(String iotHubHostname,
String deviceId,
String iotHubMethodPath,
Map<String,String> queryParams)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected static void |
appendQueryParam(StringBuilder uriBuilder,
String name,
String value)
URL-encodes the query param
name and value using charset UTF-8 and
appends them to the URI. |
String |
getHostname()
Returns the string representation of the IoT Hub hostname.
|
String |
getPath()
Returns the string representation of the IoT Hub path.
|
static String |
getResourceUri(String iotHubHostname,
String deviceId)
Returns the string representation of the IoT Hub resource URI.
|
String |
toString()
Returns the string representation of the IoT Hub URI.
|
protected static String |
urlEncodePath(String path)
URL-encodes each subdirectory in the path.
|
public static final String PATH_FORMAT
public static final String API_VERSION
public static final Charset IOTHUB_URL_ENCODING_CHARSET
protected String hostname
protected String path
protected String uri
public IotHubUri(String iotHubHostname, String deviceId, String iotHubMethodPath, Map<String,String> queryParams)
iotHubHostname - the IoT Hub hostname.deviceId - the device ID.iotHubMethodPath - the path from the IoT Hub resource to the
method.queryParams - the URL query parameters. Can be null.public IotHubUri(String iotHubHostname, String deviceId, String iotHubMethodPath)
new IotHubUri(iotHubHostname, deviceId,
iotHubMethodPath, null).iotHubHostname - the IoT Hub hostname.deviceId - the device ID.iotHubMethodPath - the path from the IoT Hub resource to the
method.protected IotHubUri()
public String toString()
public String getHostname()
public String getPath()
public static String getResourceUri(String iotHubHostname, String deviceId)
iotHubHostname - the IoT Hub hostname.deviceId - the device ID.protected static String urlEncodePath(String path)
path - the path to be safely escaped.protected static void appendQueryParam(StringBuilder uriBuilder, String name, String value)
name and value using charset UTF-8 and
appends them to the URI.uriBuilder - the URI.name - the query param name.value - the query param value.Copyright © 2017. All rights reserved.