Client: HttpCachingClient
An HTTP caching client implementation which takes an HttpActions
instance and wraps it with an HTTP caching layer.
Remote Methods
post | Responses returned for POST requests are not cacheable. |
head | Responses for HEAD requests are cacheable and as such, will be routed through the HTTP cache. |
put | Responses returned for PUT requests are not cacheable. |
execute | Invokes an HTTP call with the specified HTTP method. |
patch | Responses returned for PATCH requests are not cacheable. |
delete | Responses returned for DELETE requests are not cacheable. |
get | Responses for GET requests are cacheable and as such, will be routed through the HTTP cache. |
options | Responses returned for OPTIONS requests are not cacheable. |
forward | Forward remote function can be used to invoke an HTTP call with inbound request's HTTP method. |
submit | Submits an HTTP request to a service with the specified HTTP verb. |
getResponse | Retrieves the |
hasPromise | Checks whether an |
getNextPromise | Retrieves the next available |
getPromisedResponse | Retrieves the promised server push |
rejectPromise | Rejects an |
post
function post(string path, RequestMessage message) returns Response | ClientError
Responses returned for POST requests are not cacheable. Therefore, the requests are simply directed to the origin server. Responses received for POST requests invalidate the cached responses for the same resource.
Parameters
- path string
Resource path
- message RequestMessage
An HTTP outbound request or any allowed payload
Return Type
(Response | ClientError)The response or an http:ClientError
if failed to establish the communication with the upstream server
head
function head(string path, RequestMessage message) returns Response | ClientError
Responses for HEAD requests are cacheable and as such, will be routed through the HTTP cache. Only if a suitable response cannot be found will the request be directed to the origin server.
Parameters
- path string
Resource path
- message RequestMessage (default ())
An optional HTTP outbound request or any allowed payload
Return Type
(Response | ClientError)The response or an http:ClientError
if failed to establish the communication with the upstream server
put
function put(string path, RequestMessage message) returns Response | ClientError
Responses returned for PUT requests are not cacheable. Therefore, the requests are simply directed to the origin server. In addition, PUT requests invalidate the currently stored responses for the given path.
Parameters
- path string
Resource path
- message RequestMessage
An HTTP outbound request or any allowed payload
Return Type
(Response | ClientError)The response or an http:ClientError
if failed to establish the communication with the upstream server
execute
function execute(string httpMethod, string path, RequestMessage message) returns Response | ClientError
Invokes an HTTP call with the specified HTTP method. This is not a cacheable operation, unless the HTTP method used is GET or HEAD.
Parameters
- httpMethod string
HTTP method to be used for the request
- path string
Resource path
- message RequestMessage
An HTTP outbound request or any allowed payload
Return Type
(Response | ClientError)The response or an http:ClientError
if failed to establish the communication with the upstream server
patch
function patch(string path, RequestMessage message) returns Response | ClientError
Responses returned for PATCH requests are not cacheable. Therefore, the requests are simply directed to the origin server. Responses received for PATCH requests invalidate the cached responses for the same resource.
Parameters
- path string
Resource path
- message RequestMessage
An HTTP outbound request or any allowed payload
Return Type
(Response | ClientError)The response or an http:ClientError
if failed to establish the communication with the upstream server
delete
function delete(string path, RequestMessage message) returns Response | ClientError
Responses returned for DELETE requests are not cacheable. Therefore, the requests are simply directed to the origin server. Responses received for DELETE requests invalidate the cached responses for the same resource.
Parameters
- path string
Resource path
- message RequestMessage (default ())
An HTTP outbound request or any allowed payload
Return Type
(Response | ClientError)The response or an http:ClientError
if failed to establish the communication with the upstream server
get
function get(string path, RequestMessage message) returns Response | ClientError
Responses for GET requests are cacheable and as such, will be routed through the HTTP cache. Only if a suitable response cannot be found will the request be directed to the origin server.
Parameters
- path string
Request path
- message RequestMessage (default ())
An optinal HTTP outbound request or any allowed payload
Return Type
(Response | ClientError)The response or an http:ClientError
if failed to establish the communication with the upstream server
options
function options(string path, RequestMessage message) returns Response | ClientError
Responses returned for OPTIONS requests are not cacheable. Therefore, the requests are simply directed to the origin server. Responses received for OPTIONS requests invalidate the cached responses for the same resource.
Parameters
- path string
Request path
- message RequestMessage (default ())
An optional HTTP outbound request or any allowed payload
Return Type
(Response | ClientError)The response or an http:ClientError
if failed to establish the communication with the upstream server
forward
function forward(string path, Request request) returns Response | ClientError
Forward remote function can be used to invoke an HTTP call with inbound request's HTTP method. Only inbound requests of GET and HEAD HTTP method types are cacheable.
Return Type
(Response | ClientError)The response or an http:ClientError
if failed to establish the communication with the upstream server
submit
function submit(string httpVerb, string path, RequestMessage message) returns HttpFuture | ClientError
Submits an HTTP request to a service with the specified HTTP verb.
Parameters
- httpVerb string
The HTTP verb value
- path string
The resource path
- message RequestMessage
An HTTP outbound request or any allowed payload
Return Type
(HttpFuture | ClientError)An HttpFuture
that represents an asynchronous service invocation, or an error if the submission fails
getResponse
function getResponse(HttpFuture httpFuture) returns Response | ClientError
Retrieves the http:Response
for a previously-submitted request.
Parameters
- httpFuture HttpFuture
The http:HttpFuture
related to a previous asynchronous invocation
Return Type
(Response | ClientError)A http:Response
message, or else an http:ClientError
if the invocation fails
hasPromise
function hasPromise(HttpFuture httpFuture) returns boolean
Checks whether an http:PushPromise
exists for a previously-submitted request.
Parameters
- httpFuture HttpFuture
The http:HttpFuture
relates to a previous asynchronous invocation
getNextPromise
function getNextPromise(HttpFuture httpFuture) returns PushPromise | ClientError
Retrieves the next available http:PushPromise
for a previously-submitted request.
Parameters
- httpFuture HttpFuture
The http:HttpFuture
relates to a previous asynchronous invocation
Return Type
(PushPromise | ClientError)An http:PushPromise
message or else an http:ClientError
if the invocation fails
getPromisedResponse
function getPromisedResponse(PushPromise promise) returns Response | ClientError
Retrieves the promised server push http:Response
message.
Parameters
- promise PushPromise
The related http:PushPromise
Return Type
(Response | ClientError)A promised HTTP http:Response
message or else an http:ClientError
if the invocation fails
rejectPromise
function rejectPromise(PushPromise promise)
Rejects an http:PushPromise
. When an http:PushPromise
is rejected, there is no chance of fetching a promised
response using the rejected promise.
Parameters
- promise PushPromise
The Push Promise to be rejected