Skip to content

HTTP and Timeout Configuration

Configure the endpoint, default and per-call timeouts, and custom OkHttp.

Most Spring Boot projects only need an endpoint and three timeout values, together with one shared StationOpenApiClient bean.

The endpoint is supplied by technical support and is a complete root address beginning with http:// or https://, for example:

station:
openapi:
endpoint: http://station.example.com

The endpoint may include the context path required by the platform deployment. Do not:

  • Append /remoteApi/time or another individual operation path;
  • Include user information, a password, a query, or a fragment;
  • Use an address from a different environment than the credentials.
PropertyDefaultPurpose
connect-timeout3sMaximum time to establish a network connection
read-timeout10sMaximum time to wait for and read response data
call-timeout15sMaximum total time for one complete call

Start with the defaults for normal queries. Increase the read and call timeouts only when large downloads or longer platform processing require it. Every timeout must be positive.

The Sample’s StationOpenApiConfiguration.java creates a singleton bean and uses destroyMethod = "close" to release resources when the application stops.

Inject that bean into business services through their constructors. Do not rebuild a Client in controllers, scheduled tasks, or individual requests, because doing so prevents connection reuse.

When only one query or download needs more time, override its read and call timeouts with RequestOptions:

RequestOptions options = RequestOptions.builder()
.requestId("large-download-0001")
.readTimeout(Duration.ofMinutes(2))
.callTimeout(Duration.ofMinutes(3))
.build();
client.
result().
downloadResource(request, target, options);

Properties not overridden continue to use the Client defaults. requestId correlates logs and exceptions; it is not a business idempotency key.

Customize OkHttp only when the application must reuse an existing proxy, connection pool, or network interceptor. The available entry points and ownership rules are documented in OkHttpTransportFactory.java.

Use the SDK’s default transport when none of those requirements apply. Do not enable OkHttp automatic retries or redirects, because they can resend write or control requests below the SDK’s safety rules.

Check these items in order:

  1. The endpoint came from technical support for the intended environment;
  2. The application host can reach the address and port;
  3. No individual operation path was appended to the endpoint;
  4. The credentials belong to the same environment;
  5. The failure occurred during the connect, read, or call timeout stage.

Use the exception’s requestId, operation, and code for troubleshooting. Do not log full request bodies, response bodies, or credentials.