public class HttpClientHelper extends VertxHelperBase
getOrCreateHelper(Object, ScriptObjectMirror)
to
create exactly one instance of this helper per actor. This class
will then ensure that response and error callbacks will occur in
the same order as the queries that trigger them.
To initiate a query, create an instance of the JavaScript
ClientRequest object and call request(ScriptObjectMirror, Map)
,
passing it the ClientRequest object and a Map of options
(see the associated httpRequest.js JavaScript module, which defines
this class and utility functions for creating it).VertxHelperBase.AccessorVerticle
HelperBase.DATA_TYPE
Modifier and Type | Field and Description |
---|---|
static int |
PENDING_REQUESTS_DELAY_FACTOR
The scale factor (in milliseconds) by which requests are
delayed when PENDING_REQUESTS_THRESHOLD is exceeded.
|
static int |
PENDING_REQUESTS_THRESHOLD
The threshold of number of pending requests before further
requests introduce a delay.
|
_verticle, _vertx
_actor, _currentObj
Modifier | Constructor and Description |
---|---|
protected |
HttpClientHelper(java.lang.Object actor,
jdk.nashorn.api.scripting.ScriptObjectMirror helping)
Construct a helper for the specified actor.
|
protected |
HttpClientHelper(java.lang.Object actor,
jdk.nashorn.api.scripting.ScriptObjectMirror helping,
VertxHelperBase base)
Construct a helper for the specified actor.
|
Modifier and Type | Method and Description |
---|---|
static HttpClientHelper |
getOrCreateHelper(java.lang.Object actor,
jdk.nashorn.api.scripting.ScriptObjectMirror helping)
Get or create a helper for the specified actor.
|
void |
request(jdk.nashorn.api.scripting.ScriptObjectMirror currentObj,
java.util.Map<java.lang.String,java.lang.Object> options)
Make an HTTP request on behalf of the specified JavaScript object (an
instance of ClientRequest) with the specified options.
|
void |
reset()
Reset this handler.
|
static void |
reset(java.lang.Object actor)
Reset the helper associated with the specified actor.
|
void |
stop()
Stop a request.
|
_issueOrDeferResponse, _processPendingJob, _setBusy, closeVertx, getHelper, getImageTypes, submit, supportedReceiveTypes, supportedSendTypes, undeploy
_appendNumericToBuffer, _appendToBuffer, _error, _error, _error, _error, _extractFromBuffer, _issueResponse, _removeDuplicates, _sizeOfType, _toJavaBytes, _toJSArray, getHelping
public static int PENDING_REQUESTS_THRESHOLD
public static int PENDING_REQUESTS_DELAY_FACTOR
protected HttpClientHelper(java.lang.Object actor, jdk.nashorn.api.scripting.ScriptObjectMirror helping)
actor
- The JavaScript actor that this helps.helping
- A JavaScript object that this helps.protected HttpClientHelper(java.lang.Object actor, jdk.nashorn.api.scripting.ScriptObjectMirror helping, VertxHelperBase base)
actor
- The JavaScript actor that this helps.helping
- A JavaScript object that this helps.base
- The helper base to share a verticle with.public void request(jdk.nashorn.api.scripting.ScriptObjectMirror currentObj, java.util.Map<java.lang.String,java.lang.Object> options)
currentObj
- The JavaScript instance using this helper (a ClientRequest).options
- The options.public static HttpClientHelper getOrCreateHelper(java.lang.Object actor, jdk.nashorn.api.scripting.ScriptObjectMirror helping)
actor
- Either a JavaScript actor or a RestrictedJavaScriptInterface.helping
- JavaScript object this is helping.public void reset()
reset
in class VertxHelperBase
public static void reset(java.lang.Object actor)
actor
- the actor with the associated helper to be reset.public void stop()