Class NetworkTransport
java.lang.Object
com.codename1.crypto.rpc.NetworkTransport
- All Implemented Interfaces:
RpcTransport
The application's RpcTransport: each request goes through the NetworkManager queue as
a ConnectionRequest, waiting with addToQueueAndWait, so a call from the EDT keeps the
UI responsive. Headers added with header(String, String) go on every request, which is how a provider's
API key is passed.
Not shared with the backend, which has com.codename1.backend.WebRpcTransport instead.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds a header sent with every request, for instance an API key.Sends one request and answers the response body.timeout(int millis) The request timeout in milliseconds; 30 seconds by default.
-
Constructor Details
-
NetworkTransport
public NetworkTransport()
-
-
Method Details
-
header
Adds a header sent with every request, for instance an API key. -
timeout
The request timeout in milliseconds; 30 seconds by default. -
send
Description copied from interface:RpcTransportSends one request and answers the response body.
Parameters
method:GETorPOSTurl: the full URLcontentType: the body's media type, ornullfor a request without onebody: the body, ornull
Throws
RpcException: for a status outside 2xx, with the status and the body the server sentIOException: when the request could not be made at all
- Specified by:
sendin interfaceRpcTransport- Throws:
IOException
-