Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.

public class HttpTerminalTransport

  1. Object
  2. HttpTerminalTransport

ImplementsTerminalTransport

The default TerminalTransport, over ConnectionRequest.

Error statuses are answered like any other: a provider’s error body is what says why a request failed, so it is read and handed on rather than turned into a dialog.

Constructors

public HttpTerminalTransport()

Methods

public void setTimeout(int timeout)The read timeout in milliseconds.
public void setInsecure(boolean insecure)Makes sure a request can run while a long one holds a network thread.
public boolean prepareForLongRequest()
public void send(String method, String url, Map<String, String> headers, String contentType, String body, TerminalTransport.Callback callback)Performs one request.

Inherited nested types

Inherited fields

Inherited methods

Constructor details

HttpTerminalTransport

public HttpTerminalTransport()

Method details

setTimeout

public void setTimeout(int timeout)
The read timeout in milliseconds. Defaults to three minutes, because a synchronous terminal request is answered only once the customer has tapped (Adyen’s /sync waits up to 150 seconds).

Parameters

timeout int
the timeout in milliseconds

setInsecure

public void setInsecure(boolean insecure)
Makes sure a request can run while a long one holds a network thread. Adyen’s /sync payment stays open until the customer taps; with the default single network thread, the abort that cancels it would wait behind it and arrive only after the payment had ended, and every other request of the app would wait too. Raises the thread count to two, only while the queue is idle, because restarting the threads drops whatever they are running. The count stays at two afterwards.

Parameters

insecure boolean
true to skip the check

Returns

true when two or more network threads are running Skips the platform’s certificate check, for a terminal on the shop’s network whose certificate names no host a device can verify. Only for a protocol that authenticates its messages itself, as Adyen’s local Terminal API does with its shared key: without that, anyone on the network could answer in the terminal’s place.

prepareForLongRequest

public boolean prepareForLongRequest()

send

public void send(String method, String url, Map<String, String> headers, String contentType, String body, TerminalTransport.Callback callback)
Performs one request. Exactly one of the callback’s methods must be called, on the EDT.

Parameters

method String
GET or POST
url String
the absolute URL
headers Map<String, String>
request headers; may be empty, never null
contentType String
the body’s content type, or null for a bodiless request
body String
the request body, or null
callback TerminalTransport.Callback
receives the outcome