public interface HttpProvider
Modifier and Type | Method and Description |
---|---|
HttpRequest |
createRequest(String method,
URL url)
Create a new outgoing HTTP request.
|
OutgoingHttpRequestActivity |
createRequestActivity(HttpRequest request)
Create a new outgoing HTTP request activity.
|
OutgoingHttpRequestActivity |
createRequestActivity(HttpRequest request,
boolean endOnResponse)
Create a new outgoing HTTP request activity.
|
byte[] |
marshalRequest(HttpRequest request)
Marshal the HTTP request into a byte array that can be serialized (e.g., stored in a CMP field).
|
byte[] |
marshalResponse(HttpResponse response)
Marshal the HTTP response into a byte array that can be serialized (e.g., stored in a CMP field).
|
OutgoingHttpRequestActivity |
sendRequest(HttpRequest request)
Asynchronously send an HTTP request to a remote host.
|
OutgoingHttpRequestActivity |
sendRequest(HttpRequest request,
boolean endOnResponse)
Asynchronously send an HTTP request to a remote host, optionally request the activity
to stay alive after the response is received.
|
HttpResponse |
sendSyncRequest(HttpRequest request)
Synchronously send an HTTP request to a remote host and block until the response
arrives or the request times out.
|
HttpRequest |
unmarshalRequest(byte[] b)
Unmarshal an HTTP request from the byte array.
|
HttpResponse |
unmarshalResponse(byte[] b)
Unmarshal an HTTP response from the byte array.
|
OutgoingHttpRequestActivity createRequestActivity(HttpRequest request) throws IOException
request
- the request to send. The request will be sent to the endpoint
specified in the request's URL.OutgoingHttpRequestActivity
activity object, the SBB
must attach to this in order to receive the response asynchronously. The activity
will automatically end when the response arrives.IOException
- if unable to create the activity, for example due to an
UnknownHostExceptionOutgoingHttpRequestActivity createRequestActivity(HttpRequest request, boolean endOnResponse) throws IOException
request
- the request to send. The request will be sent to the endpoint
specified in the request's URL.endOnResponse
- if true
, the RA will automatically end the
activity when the response arrives. If false
, the activity must be ended
explicitly using OutgoingHttpRequestActivity.endActivity()
.HttpResponse
received. If the request times out, the stack
will return a 500 server error response.IOException
- if unable to create the activity, for example due to an
UnknownHostExceptionHttpRequest createRequest(String method, URL url)
method
- a HTTP method string, e.g. "GET"url
- an HTTP URL containing the remote host and resource to retrieveOutgoingHttpRequestActivity sendRequest(HttpRequest request) throws IOException
request
- the request to send. The request will be sent to the endpoint
specified in the request's URL.OutgoingHttpRequestActivity
activity object, the SBB
must attach to this in order to receive the response asynchronously. The activity
will automatically end when the response arrives.IOException
- if unable to send the requestOutgoingHttpRequestActivity sendRequest(HttpRequest request, boolean endOnResponse) throws IOException
request
- the request to send. The request will be sent to the endpoint
specified in the request's URL.endOnResponse
- if true
, the RA will automatically end the
activity when the response arrives. If false
, the activity must be ended
explicitly using OutgoingHttpRequestActivity.endActivity()
.OutgoingHttpRequestActivity
activity object, the SBB
must attach to this in order to receive the response asynchronously.IOException
- if unable to send the requestHttpResponse sendSyncRequest(HttpRequest request) throws IOException
request
- the request to send. The request will be sent to the endpoint
specified in the request's URL.HttpResponse
received. If the request times out, the stack
will return a 500 server error response.IOException
- if unable to send the requestbyte[] marshalRequest(HttpRequest request) throws IOException
request
- the request to marshalIOException
- if unable to marshal the HTTP request to a byte arrayHttpRequest unmarshalRequest(byte[] b) throws IOException
b
- the byte array to unmarshalIOException
- if unable to unmarshal an HTTP request from the byte arraybyte[] marshalResponse(HttpResponse response) throws IOException
response
- the response to marshalIOException
- if unable to marshal the HTTP response to a byte arrayHttpResponse unmarshalResponse(byte[] b) throws IOException
b
- the byte array to unmarshalIOException
- if unable to unmarshal an HTTP response from the byte array