public final class HttpTranslator
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.util.Properties |
HTTP_TRANSLATION_PROPERTIES
Property file containing the mappings between coap messages and http
messages.
|
static int |
STATUS_NOT_FOUND |
static int |
STATUS_TIMEOUT |
static int |
STATUS_TRANSLATION_ERROR |
static int |
STATUS_URI_MALFORMED |
static int |
STATUS_WRONG_METHOD |
| Modifier and Type | Method and Description |
|---|---|
static Request |
createCoapRequestDiscovery(java.lang.String proxyUri) |
static Request |
createCoapRequestOptions(java.lang.String proxyUri) |
static int |
getCoapMediaType(org.apache.http.HttpMessage httpMessage)
Gets the coap media type associated to the http entity.
|
static java.util.List<Option> |
getCoapOptions(org.apache.http.Header[] headers)
Gets the coap options starting from an array of http headers.
|
static byte[] |
getCoapPayload(org.apache.http.HttpEntity httpEntity)
Method to map the http entity of a http message in a coherent payload for
the coap message.
|
static Request |
getCoapRequest(org.apache.http.HttpRequest httpRequest,
java.lang.String proxyResource,
boolean proxyingEnabled)
Gets the coap request.
|
static Response |
getCoapResponse(org.apache.http.HttpResponse httpResponse,
Request coapRequest)
Gets the CoAP response from an incoming HTTP response.
|
static void |
getHttpDiscovery(org.apache.http.HttpRequest httpRequest,
Response coapResponse,
org.apache.http.HttpResponse httpResponse) |
static org.apache.http.HttpEntity |
getHttpEntity(Message coapMessage)
Generates an HTTP entity starting from a CoAP request.
|
static org.apache.http.Header[] |
getHttpHeaders(java.util.List<Option> optionList,
java.lang.String host)
Gets the http headers from a list of CoAP options.
|
static void |
getHttpOptions(org.apache.http.HttpRequest httpRequest,
Response coapResponse,
org.apache.http.HttpResponse httpResponse) |
static org.apache.http.HttpRequest |
getHttpRequest(Request coapRequest)
Gets the http request starting from a CoAP request.
|
static void |
getHttpResponse(org.apache.http.HttpRequest httpRequest,
Response coapResponse,
org.apache.http.HttpResponse httpResponse)
Sets the parameters of the incoming http response from a CoAP response.
|
public static final java.util.Properties HTTP_TRANSLATION_PROPERTIES
public static final int STATUS_TIMEOUT
public static final int STATUS_NOT_FOUND
public static final int STATUS_TRANSLATION_ERROR
public static final int STATUS_URI_MALFORMED
public static final int STATUS_WRONG_METHOD
public static int getCoapMediaType(org.apache.http.HttpMessage httpMessage)
httpMessage - public static java.util.List<Option> getCoapOptions(org.apache.http.Header[] headers)
headers - public static byte[] getCoapPayload(org.apache.http.HttpEntity httpEntity)
throws TranslationException
httpEntity - the http entityTranslationException - the translation exceptionpublic static Request getCoapRequest(org.apache.http.HttpRequest httpRequest, java.lang.String proxyResource, boolean proxyingEnabled) throws TranslationException
httpRequest - the http requestproxyResource - the proxy resource, if present in the uri, indicates the need
of forwarding for the current requestproxyingEnabled - TODOTranslationExceptionpublic static Request createCoapRequestDiscovery(java.lang.String proxyUri) throws TranslationException
TranslationExceptionpublic static Request createCoapRequestOptions(java.lang.String proxyUri) throws TranslationException
TranslationExceptionpublic static Response getCoapResponse(org.apache.http.HttpResponse httpResponse, Request coapRequest) throws TranslationException
httpResponse - the http responsecoapRequest - TranslationExceptionpublic static org.apache.http.HttpEntity getHttpEntity(Message coapMessage) throws TranslationException
coapMessage - the coap messageTranslationExceptionpublic static org.apache.http.Header[] getHttpHeaders(java.util.List<Option> optionList, java.lang.String host)
optionList - the coap messagepublic static org.apache.http.HttpRequest getHttpRequest(Request coapRequest) throws TranslationException
coapRequest - the coap requestTranslationExceptionpublic static void getHttpResponse(org.apache.http.HttpRequest httpRequest,
Response coapResponse,
org.apache.http.HttpResponse httpResponse)
throws TranslationException
coapResponse - the coap responsehttpResponse - httpRequest - HttpRequestTranslationException - the translation exceptionpublic static void getHttpDiscovery(org.apache.http.HttpRequest httpRequest,
Response coapResponse,
org.apache.http.HttpResponse httpResponse)
public static void getHttpOptions(org.apache.http.HttpRequest httpRequest,
Response coapResponse,
org.apache.http.HttpResponse httpResponse)