Module : http

Module Overview

This module provides an implementation for connecting and interacting with HTTP, HTTP2, and WebSocket endpoints. The module facilitates two types of network entry points as ‘Client’ and ‘Listener’.

Client

The Client is used to connect to and interact with HTTP endpoints. They support connection pooling and can be configured to have a maximum number of active connections that can be made with the remote endpoint. The Client activates connection eviction after a given idle period and also supports follow-redirects so that the users do not have to manually handle 3xx HTTP status codes.

The Client handles resilience in multiple ways such as load balancing, circuit breaking, endpoint timeouts, and a retry mechanism.

Load balancing is used in the round robin or failover manner.

When a failure occurs in the remote service, the client connections might wait for some time before a timeout occurs. Awaiting requests consume resources in the system. Circuit Breakers are used to trip after a certain number of failed requests to the remote service. Once a circuit breaker trips, it does not allow the client to send requests to the remote service for a period of time.

The Ballerina circuit breaker supports tripping on HTTP error status codes and I/O errors. Failure thresholds can be configured based on a sliding window (e.g., 5 failures within 10 seconds). Client endpoints also support a retry mechanism that allows a client to resend failed requests periodically for a given number of times.

The Client supports Server Name Indication (SNI), Certificate Revocation List (CRL), Online Certificate Status Protocol (OCSP), and OCSP Stapling for SSL/TLS connections. They also support HTTP2, keep-alive, chunking, HTTP caching, data compression/decompression, and authentication/authorization.

A Client can be defined using the URL of the remote service that the client needs to connect with, as shown below:

http:Client clientEndpoint = new("https://my-simple-backend.com");

The defined Client endpoint can be used to call a remote service as follows:

// Send a GET request to the specified endpoint.
var response = clientEndpoint->get("/get?id=123");

For more information, see the following.

Listener

A Service represents a collection of network-accessible entry points and can be exposed via a Listener endpoint. A resource represents one such entry point and can have its own path, HTTP methods, body format, 'consumes' and 'produces' content types, CORS headers, etc. In resources, http:caller and http:Request are mandatory parameters while path and body are optional.

When a Service receives a request, it is dispatched to the best-matched resource.

A Listener endpoint can be defined as follows:

// Attributes associated with the `Listener` endpoint are defined here.
listener http:Listener helloWorldEP = new(9090);

Then a Service can be defined and attached to the above Listener endpoint as shown below:

// By default, Ballerina assumes that the service is to be exposed via HTTP/1.1.
@http:ServiceConfig { basePath: "/helloWorld" }
service helloWorld on helloWorldEP {

   // All resource functions are invoked with arguments of server connector and request.
   @http:ResourceConfig {
       methods: ["POST"],
       path: "/{name}",
       body: "message"
   }
   resource function sayHello(http:Caller caller, http:Request req, string name, string message) {
       http:Response res = new;
       // A util method that can be used to set string payload.
       res.setPayload("Hello, World! I’m " + <@untainted> name + ". " + <@untainted> message);
       // Sends the response back to the client.
       var result = caller->respond(res);
       if (result is http:ListenerError) {
            error err = result;
            log:printError("Error sending response", err = err);
       }
   }
}

See the following.

Listener endpoints can be exposed via SSL. They support Mutual SSL, Hostname Verification, and Application Layer Protocol Negotiation (ALPN) for HTTP2. Listener endpoints also support Certificate Revocation List (CRL), Online Certificate Status Protocol (OCSP), OCSP Stapling, HTTP2, keep-alive, chunking, HTTP caching, data compression/decompression, and authentication/authorization.

For more information, see Mutual SSL Example.

For more information, see Caching Example, HTTP Disable Chunking Example.

WebSocket

This module also provides support for WebSockets. There are two types of WebSocket endpoints: WebSocketClient and WebSocketListener. Both endpoints support all WebSocket frames. The WebSocketClient has a callback service.

There are two types of services for WebSockets. The service of the server has the WebSockerCaller as the resource parameter and the callback service of the client has WebSocketClient as the resource parameter. The WebSocket services have a fixed set of resources that do not have a resource config. The incoming messages are passed to these resources.

WebSocket upgrade: During a WebSocket upgrade, the initial message received is an HTTP request. To intercept this request and perform the upgrade explicitly with custom headers, the user must create an HTTP resource with WebSocket-specific configurations as follows:

@http:ResourceConfig {
    webSocketUpgrade: {
        upgradePath: "/{name}",
        upgradeService: chatApp
    }
}
resource function upgrader(http:Caller caller, http:Request req, string name) {
}

The upgradeService is a server callback service.

onOpen resource: As soon as the WebSocket handshake is completed and the connection is established, the onOpen resource is dispatched. This resource is only available in the service of the server.

onText resource: The received text messages are dispatched to this resource.

onBinary resource: The received binary messages are dispatched to this resource.

onPing and onPong resources: The received ping and pong messages are dispatched to these resources respectively.

onIdleTimeout: This resource is dispatched when the idle timeout is reached. The idleTimeout has to be configured either in the WebSocket service or the client configuration.

onClose: This resource is dispatched when a close frame with a statusCode and a reason is received.

onError: This resource is dispatched when an error occurs in the WebSocket connection. This will always be preceded by a connection closure with an appropriate close frame.

For more information, see the following.

Logging

This module supports two types of logs:

To publish logs to a socket, both the host and port configurations must be provided.

See HTTP Access Logs Example, HTTP Trace Logs Example

Records

Bucket

Represents a discrete sub-part of the time window (Bucket).

CacheConfig

Provides a set of configurations for controlling the caching behaviour of the endpoint.

CircuitBreakerConfig

Provides a set of configurations for controlling the behaviour of the Circuit Breaker.

CircuitBreakerInferredConfig

Derived set of configurations from the CircuitBreakerConfig.

CircuitHealth

Maintains the health of the Circuit Breaker.

ClientConfiguration

Provides a set of configurations for controlling the behaviours when communicating with a remote HTTP endpoint.

ClientHttp1Settings

Provides settings related to HTTP/1.

ClientHttp2Settings

Provides settings related to HTTP/2 protocol.

ClientSecureSocket

Provides configurations for facilitating secure communication with a remote HTTP endpoint.

CommonClientConfiguration

Common client configurations for the next level clients.

CompressionConfig

A record for providing configurations for content compression.

CookieConfig

Client configuration for cookies.

CorsConfig

Configurations for CORS support.

Detail

Holds the details of an HTTP error

FailoverClientConfiguration

Provides a set of HTTP related configurations and failover related configurations.

FailoverConfig

Provides a set of configurations for controlling the failover behaviour of the endpoint.

FailoverInferredConfig

Represents the inferred failover configurations passed into the failover client.

FollowRedirects

Provides configurations for controlling the endpoint's behaviour in response to HTTP redirect related responses.

HttpResourceConfig

Configuration for an HTTP resource.

HttpServiceConfig

Contains the configurations for an HTTP service.

HttpTimeoutError

Defines a timeout error occurred during service invocation.

ListenerAuth

Authentication configurations for the listener.

ListenerConfiguration

Provides a set of configurations for HTTP service endpoints.

ListenerHttp1Settings

Provides settings related to HTTP/1.

ListenerOcspStapling

A record for providing configurations for certificate revocation status checks.

ListenerSecureSocket

Configures the SSL/TLS options to be used for HTTP service.

LoadBalanceActionErrorData

Represents an error occurred in an remote function of the Load Balance connector.

LoadBalanceClientConfiguration

The configurations related to the load balance client endpoint.

Local

Presents a read-only view of the local address.

MutualSslHandshake

A record for providing mutual SSL handshake results.

OutboundAuthConfig

The OutboundAuthConfig record can be used to configure the authentication mechanism used by the HTTP endpoint.

PoolConfiguration

Configurations for managing HTTP client connection pool.

Protocols

A record for configuring SSL/TLS protocol and version to be used.

ProxyConfig

Proxy server configurations to be used with the HTTP client endpoint.

Remote

Presents a read-only view of the remote address.

RequestLimitConfigs

Provides inbound request URI, total header and entity body size threshold configurations.

ResourceAuth

Configures the authentication scheme for a resource.

ResponseLimitConfigs

Provides inbound response status line, total header and entity body size threshold configurations.

RetryConfig

Provides configurations for controlling the retrying behavior in failure scenarios.

RetryInferredConfig

Derived set of configurations from the RetryConfig.

RollingWindow

Represents a rolling window in the Circuit Breaker.

ServiceAuth

Configures the authentication scheme for a service.

TargetService

Represents a single service and its related configurations.

ValidateCert

A record for providing configurations for certificate revocation status checks.

Versioning

Configurations for service versioning.

WSServiceConfig

Configurations for a WebSocket service.

WebSocketClientConfiguration

Configurations for the WebSocket client endpoint.

WebSocketFailoverClientConfiguration

Configurations for the WebSocket client endpoint.

WebSocketRetryConfig

Retry configurations for WebSocket.

WebSocketUpgradeConfig

Resource configuration to upgrade from HTTP to WebSocket.

Objects

AuthnFilter

Representation of the Authentication filter.

AuthzFilter

Representation of the Authorization filter.

AuthzHandler

Representation of Authorization Handler for HTTP.

BasicAuthHandler

Defines the Basic Auth header handler for inbound and outbound HTTP traffic.

BearerAuthHandler

Representation of the Bearer Auth header handler for both inbound and outbound HTTP traffic.

Represents a Cookie.

CookieClient

Provides the cookie functionality across HTTP client actions.

CookieStore

Represents the cookie store.

CsvPersistentCookieHandler

Represents a default persistent cookie handler, which stores persistent cookies in a CSV file.

FilterContext

Representation of request filter Context.

HttpCache

Implements a cache for storing HTTP responses.

HttpFuture

Represents a 'future' that returns as a result of an asynchronous HTTP request submission.

InboundAuthHandler

The representation of an inbound authentication handler for HTTP traffic.

LoadBalancerRoundRobinRule

Implementation of round robin load balancing strategy.

LoadBalancerRule

LoadBalancerRule provides a required interfaces to implement different algorithms.

OutboundAuthHandler

The representation of an outbound authentication handler for HTTP traffic.

PersistentCookieHandler

The representation of a persistent cookie handler for managing persistent cookies.

PushPromise

Represents an HTTP/2 PUSH_PROMISE frame.

Request

Represents an HTTP request.

RequestCacheControl

Configures the cache control directives for an http:Request.

RequestFilter

Abstract Representation of a HTTP Request Filter.

Response

Represents an HTTP response.

ResponseCacheControl

Configures cache control directives for an http:Response.

ResponseFilter

Abstract Representation of a HTTP Response Filter.

Clients

Caller

The caller actions for responding to client requests.

CircuitBreakerClient

A Circuit Breaker implementation which can be used to gracefully handle network failures.

Client

The HTTP client provides the capability for initiating contact with a remote HTTP service.

FailoverClient

An HTTP client endpoint which provides failover support over multiple HTTP clients.

HttpCachingClient

An HTTP caching client implementation which takes an HttpActions instance and wraps it with an HTTP caching layer.

HttpClient

Provides the HTTP actions for interacting with an HTTP server.

HttpSecureClient

Provides secure HTTP remote functions for interacting with HTTP endpoints.

LoadBalanceClient

LoadBalanceClient endpoint provides load balancing functionality over multiple HTTP clients.

RedirectClient

Provides redirect functionality for HTTP client remote functions.

RetryClient

Provides the HTTP remote functions for interacting with an HTTP endpoint.

WebSocketCaller

Represents a WebSocket caller.

WebSocketClient

Represents a WebSocket client endpoint.

WebSocketFailoverClient

A WebSocket client endpoint, which provides failover support for multiple WebSocket targets.

Listeners

Listener

This is used for creating HTTP server endpoints.

MockListener

Mock server endpoint which does not open a listening port.

Functions

createHttpCachingClient

Creates an HTTP client capable of caching HTTP responses.

createHttpSecureClient

Creates an HTTP client capable of securing HTTP requests with authentication.

extractAuthorizationHeaderValue

Extracts the Authorization header value from the request.

invokeEndpoint

The HEAD remote function implementation of the Circuit Breaker.

isResourceSecured

Checks whether the calling resource is secured by evaluating the authentication hierarchy.

parseHeader

Parses the given header value to extract its value and parameter map.

Constants

AUTH_HEADER

Represents the Authorization header name.

AUTH_HEADER_BEARER

Indicates that the authentication credentials should be sent via the Authentication header.

POST_BODY_BEARER

Indicates that the Authentication credentials should be sent via the body of the POST request.

NO_BEARER

Indicates that the authentication credentials should not be sent.

STATUS_CODE

Indicates the status code.

NO_CACHE

Forces the cache to validate a cached response with the origin server before serving.

NO_STORE

Instructs the cache to not store a response in non-volatile storage.

NO_TRANSFORM

Instructs intermediaries not to transform the payload.

MAX_AGE

When used in requests, max-age implies that clients are not willing to accept responses whose age is greater than max-age.

MAX_STALE

Indicates that the client is willing to accept responses which have exceeded their freshness lifetime by no more than the specified number of seconds.

MIN_FRESH

Indicates that the client is only accepting responses whose freshness lifetime >= current age + min-fresh.

ONLY_IF_CACHED

Indicates that the client is only willing to accept a cached response.

MUST_REVALIDATE

Indicates that once the response has become stale, it should not be reused for subsequent requests without validating with the origin server.

PUBLIC

Indicates that any cache may store the response.

PRIVATE

Indicates that the response is intended for a single user and should not be stored by shared caches.

PROXY_REVALIDATE

Has the same semantics as must-revalidate, except that this does not apply to private caches.

S_MAX_AGE

In shared caches, s-maxage overrides the max-age or expires header field.

MAX_STALE_ANY_AGE

Setting this as the max-stale directives indicates that the max-stale directive does not specify a limit.

CACHE_CONTROL_AND_VALIDATORS

This is a more restricted mode of RFC 7234.

RFC_7234

Caching behaviour is as specified by the RFC 7234 specification.

HTTP_ERROR_CODE

Constant for the http error code

MULTIPART_AS_PRIMARY_TYPE

Represents multipart primary type

HTTP_FORWARD

Constant for the HTTP FORWARD method

HTTP_GET

Constant for the HTTP GET method

HTTP_POST

Constant for the HTTP POST method

HTTP_DELETE

Constant for the HTTP DELETE method

HTTP_OPTIONS

Constant for the HTTP OPTIONS method

HTTP_PUT

Constant for the HTTP PUT method

HTTP_PATCH

Constant for the HTTP PATCH method

HTTP_HEAD

Constant for the HTTP HEAD method

HTTP_SUBMIT

constant for the HTTP SUBMIT method

HTTP_NONE

Constant for the identify not an HTTP Operation

CHUNKING_AUTO

If the payload is less than 8KB, content-length header is set in the outbound request/response, otherwise chunking header is set in the outbound request/response.

CHUNKING_ALWAYS

Always set chunking header in the response.

CHUNKING_NEVER

Never set the chunking header even if the payload is larger than 8KB in the outbound request/response.

COMPRESSION_AUTO

When service behaves as a HTTP gateway inbound request/response accept-encoding option is set as the outbound request/response accept-encoding/content-encoding option.

COMPRESSION_ALWAYS

Always set accept-encoding/content-encoding in outbound request/response.

COMPRESSION_NEVER

Never set accept-encoding/content-encoding header in outbound request/response.

REDIRECT_MULTIPLE_CHOICES_300

Represents the HTTP redirect status code 300 - Multiple Choices.

REDIRECT_MOVED_PERMANENTLY_301

Represents the HTTP redirect status code 301 - Moved Permanently.

REDIRECT_FOUND_302

Represents the HTTP redirect status code 302 - Found.

REDIRECT_SEE_OTHER_303

Represents the HTTP redirect status code 303 - See Other.

REDIRECT_NOT_MODIFIED_304

Represents the HTTP redirect status code 304 - Not Modified.

REDIRECT_USE_PROXY_305

Represents the HTTP redirect status code 305 - Use Proxy.

REDIRECT_TEMPORARY_REDIRECT_307

Represents the HTTP redirect status code 307 - Temporary Redirect.

REDIRECT_PERMANENT_REDIRECT_308

Represents the HTTP redirect status code 308 - Permanent Redirect.

FAILOVER_ALL_ENDPOINTS_FAILED

Represents the reason string for the http:FailoverAllEndpointsFailedError

FAILOVER_ENDPOINT_ACTION_FAILED

Represents the reason string for the http:FailoverActionFailedError

UPSTREAM_SERVICE_UNAVAILABLE

Represents the reason string for the http:UpstreamServiceUnavailableError

ALL_LOAD_BALANCE_ENDPOINTS_FAILED

Represents the reason string for the http:AllLoadBalanceEndpointsFailedError

ALL_RETRY_ATTEMPTS_FAILED

Represents the reason string for the http:AllRetryAttemptsFailed

IDLE_TIMEOUT_TRIGGERED

Represents the reason string for the http:IdleTimeoutError

AUTHN_FAILED

Represents the reason string for the http:AuthenticationError

AUTHZ_FAILED

Represents the reason string for the http:AuthorizationError

INIT_OUTBOUND_REQUEST_FAILED

Represents the reason string for the http:InitializingOutboundRequestError

WRITING_OUTBOUND_REQUEST_HEADERS_FAILED

Represents the reason string for the http:WritingOutboundRequestHeadersError

WRITING_OUTBOUND_REQUEST_BODY_FAILED

Represents the reason string for the http:WritingOutboundRequestBodyError

INIT_INBOUND_RESPONSE_FAILED

Represents the reason string for the http:InitializingInboundResponseError

READING_INBOUND_RESPONSE_HEADERS_FAILED

Represents the reason string for the http:ReadingInboundResponseBodyError

READING_INBOUND_RESPONSE_BODY_FAILED

Represents the reason string for the http:ReadingInboundResponseBodyError

INIT_INBOUND_REQUEST_FAILED

Represents the reason string for the http:InitialingInboundRequestError

READING_INBOUND_REQUEST_HEADERS_FAILED

Represents the reason string for the http:ReadingInboundRequestHeadersError

READING_INBOUND_REQUEST_BODY_FAILED

Represents the reason string for the http:ReadingInboundRequestBodyError

INIT_OUTBOUND_RESPONSE_FAILED

Represents the reason string for the http:InitializingOutboundResponseError

WRITING_OUTBOUND_RESPONSE_HEADERS_FAILED

Represents the reason string for the http:WritingOutboundResponseHeadersError

WRITING_OUTBOUND_RESPONSE_BODY_FAILED

Represents the reason string for the http:WritingOutboundResponseBodyError

INITIATING_100_CONTINUE_RESPONSE_FAILED

Represents the reason string for the http:Initiating100ContinueResponseError

WRITING_100_CONTINUE_RESPONSE_FAILED

Represents the reason string for the http:Writing100ContinueResponseError

Represents the reason string for the http:InvalidCookieError

GENERIC_CLIENT_ERROR

Error reason for generic client error

GENERIC_LISTENER_ERROR

Represents the reason string for the http:GenericListenerError

UNSUPPORTED_ACTION

Represents the reason string for the http:UnsupportedActionError

HTTP2_CLIENT_ERROR

Represents the reason string for the http:Http2ClientError

MAXIMUM_WAIT_TIME_EXCEEDED

Represents the reason string for the http:MaximumWaitTimeExceededError

SSL_ERROR

Represents the reason string for the http:SslError

Represents the reason string for the http:CookieHandlingError

AGE

HTTP header key age.

AUTHORIZATION

HTTP header key authorization

CACHE_CONTROL

HTTP header key cache-control.

CONTENT_LENGTH

HTTP header key content-length.

CONTENT_TYPE

HTTP header key content-type.

DATE

HTTP header key date.

ETAG

HTTP header key etag.

EXPECT

HTTP header key expect.

EXPIRES

HTTP header key expires.

IF_MATCH

HTTP header key if-match

IF_MODIFIED_SINCE

HTTP header key if-modified-since.

IF_NONE_MATCH

HTTP header key if-none-match.

IF_RANGE

HTTP header key if-range

IF_UNMODIFIED_SINCE

HTTP header key if-unmodified-since

LAST_MODIFIED

HTTP header key last-modified.

LOCATION

HTTP header key location.

PRAGMA

HTTP header key pragma.

PROXY_AUTHORIZATION

HTTP header key proxy-authorization.

SERVER

HTTP header key server.

WARNING

HTTP header key warning.

TRANSFER_ENCODING

HTTP header key transfer-encoding.

CONNECTION

HTTP header key connection.

UPGRADE

HTTP header key upgrade.

PASSED

Mutual SSL handshake is successful.

FAILED

Mutual SSL handshake has failed.

NONE

Not a mutual ssl connection.

CB_OPEN_STATE

Represents the open state of the circuit.

CB_HALF_OPEN_STATE

Represents the half-open state of the circuit.

CB_CLOSED_STATE

Represents the closed state of the circuit.

STATUS_CONTINUE

The HTTP response status code: 100 Continue

STATUS_SWITCHING_PROTOCOLS

The HTTP response status code: 101 Switching Protocols

STATUS_OK

The HTTP response status code: 200 OK

STATUS_CREATED

The HTTP response status code: 201 Created

STATUS_ACCEPTED

The HTTP response status code: 202 Accepted

STATUS_NON_AUTHORITATIVE_INFORMATION

The HTTP response status code: 203 Non Authoritative Information

STATUS_NO_CONTENT

The HTTP response status code: 204 No Content

STATUS_RESET_CONTENT

The HTTP response status code: 205 Reset Content

STATUS_PARTIAL_CONTENT

The HTTP response status code: 206 Partial Content

STATUS_MULTIPLE_CHOICES

The HTTP response status code: 300 Multiple Choices

STATUS_MOVED_PERMANENTLY

The HTTP response status code: 301 Moved Permanently

STATUS_FOUND

The HTTP response status code: 302 Found

STATUS_SEE_OTHER

The HTTP response status code: 303 See Other

STATUS_NOT_MODIFIED

The HTTP response status code: 304 Not Modified

STATUS_USE_PROXY

The HTTP response status code: 305 Use Proxy

STATUS_TEMPORARY_REDIRECT

The HTTP response status code: 307 Temporary Redirect

STATUS_PERMANENT_REDIRECT

The HTTP response status code: 308 Permanent Redirect

STATUS_BAD_REQUEST

The HTTP response status code: 400 Bad Request

STATUS_UNAUTHORIZED

The HTTP response status code: 401 Unauthorized

STATUS_PAYMENT_REQUIRED

The HTTP response status code: 402 Payment Required

STATUS_FORBIDDEN

The HTTP response status code: 403 Forbidden

STATUS_NOT_FOUND

The HTTP response status code: 404 Not Found

STATUS_METHOD_NOT_ALLOWED

The HTTP response status code: 405 Method Not Allowed

STATUS_NOT_ACCEPTABLE

The HTTP response status code: 406 Not Acceptable

STATUS_PROXY_AUTHENTICATION_REQUIRED

The HTTP response status code: 407 Proxy Authentication Required

STATUS_REQUEST_TIMEOUT

The HTTP response status code: 408 Request Timeout

STATUS_CONFLICT

The HTTP response status code: 409 Conflict

STATUS_GONE

The HTTP response status code: 410 Gone

STATUS_LENGTH_REQUIRED

The HTTP response status code: 411 Length Required

STATUS_PRECONDITION_FAILED

The HTTP response status code: 412 Precondition Failed

STATUS_PAYLOAD_TOO_LARGE

The HTTP response status code: 413 Payload Too Large

STATUS_URI_TOO_LONG

The HTTP response status code: 414 URI Too Long

STATUS_UNSUPPORTED_MEDIA_TYPE

The HTTP response status code: 415 Unsupported Media Type

STATUS_RANGE_NOT_SATISFIABLE

The HTTP response status code: 416 Range Not Satisfiable

STATUS_EXPECTATION_FAILED

The HTTP response status code: 417 Expectation Failed

STATUS_UPGRADE_REQUIRED

The HTTP response status code: 426 Upgrade Required

STATUS_INTERNAL_SERVER_ERROR

The HTTP response status code: 500 Internal Server Error

STATUS_NOT_IMPLEMENTED

The HTTP response status code: 501 Not Implemented

STATUS_BAD_GATEWAY

The HTTP response status code: 502 Bad Gateway

STATUS_SERVICE_UNAVAILABLE

The HTTP response status code: 503 Service Unavailable

STATUS_GATEWAY_TIMEOUT

The HTTP response status code: 504 Gateway Timeout

STATUS_HTTP_VERSION_NOT_SUPPORTED

The HTTP response status code: 505 HTTP Version Not Supported

KEEPALIVE_AUTO

Decides to keep the connection alive or not based on the connection header of the client request }

KEEPALIVE_ALWAYS

Keeps the connection alive irrespective of the connection header value }

KEEPALIVE_NEVER

Closes the connection irrespective of the connection header value }

SERVICE_NAME

Constant for the service name reference.

RESOURCE_NAME

Constant for the resource name reference.

REQUEST_METHOD

Constant for the request method reference.

CONNECTION_CLOSURE_ERROR

Error reason for failures during connection closure

INVALID_HANDSHAKE_ERROR

Error reason for WebSocket handshake failures

PAYLOAD_TOO_BIG_ERROR

Error reason for exceeding maximum frame size

PROTOCOL_ERROR

Error reason for other side breaking the protocol

CONNECTION_ERROR

Error reason for connection failures

INVALID_CONTINUATION_FRAME_ERROR

Error reason for invalid continuation frame

GENERIC_ERROR

Error reason for errors not captured by the specific errors

Annotations

ResourceConfig

The annotation which is used to configure an HTTP resource.

ServiceConfig

The annotation which is used to configure an HTTP service.

WebSocketServiceConfig

The annotation which is used to configure a WebSocket service.

Types

CachingPolicy

Used for configuring the caching behaviour.

Chunking

Defines the possible values for the chunking configuration in HTTP services and clients.

CircuitState

A finite type for modeling the states of the Circuit Breaker.

ClientAuthError

Defines the Auth error types that returned from client

ClientError

Defines the possible client error types

Compression

Options to compress using gzip or deflate.

CredentialBearer

Specifies how to send the authentication credentials when exchanging tokens.

HttpOperation

Defines the HTTP operations related to circuit breaker, failover and load balancer.

HttpVersion

Defines the supported HTTP protocols.

InboundAuthHandlers

Represents inbound auth handler patterns.

InboundRequestError

Defines the listener error types that returned while receiving inbound request

InboundResponseError

Defines the client error types that returned while receiving inbound response

KeepAlive

Defines the possible values for the keep-alive configuration in service and client endpoints.

ListenerError

Defines the possible listener error types

MutualSslStatus

Defines the possible values for the mutual ssl status.

OutboundRequestError

Defines the client error types that returned while sending outbound request

OutboundResponseError

Defines the listener error types that returned while sending outbound response

RedirectCode

Defines the HTTP redirect codes as a type.

RequestMessage

The types of messages that are accepted by HTTP client when sending out the outbound request.

ResiliencyError

Defines the resiliency error types that returned from client

ResponseMessage

The types of messages that are accepted by HTTP listener when sending out the outbound response.

Scopes

Represents scopes patterns.

WebSocketError

The union of all the WebSocket related errors

Errors

AllLoadBalanceEndpointsFailedError

Represents a client error that occurred due to all the load balance endpoint failure

AllRetryAttemptsFailed

Represents a client error that occurred due to all the the retry attempts failure

AuthenticationError

Represents a listener error that occurred due to inbound request authentication failure

AuthorizationError

Represents a listener error that occurred due to inbound request authorization failure

CookieHandlingError

Represents a cookie error that occurred when using the cookies

FailoverActionFailedError

Represents a client error that occurred due to failover action failure

FailoverAllEndpointsFailedError

Represents a client error that occurred due to all the failover endpoint failure

GenericClientError

Represents a generic client error

GenericListenerError

Represents a generic listener error

Http2ClientError

Represents an HTTP/2 client generic error

IdleTimeoutError

Represents the error that triggered upon a request/response idle timeout

InitializingInboundRequestError

Represents a listener error that occurred due to inbound request initialization failure

InitializingInboundResponseError

Represents a client error that occurred due to inbound response initialization failure

InitializingOutboundRequestError

Represents a client error that occurred due to outbound request initialization failure

InitializingOutboundResponseError

Represents a listener error that occurred due to outbound response initialization failure

Initiating100ContinueResponseError

Represents an error that occurred due to 100 continue response initialization failure

InvalidCookieError

Represents a cookie error that occurred when sending cookies in the response

LoadBalanceActionError
MaximumWaitTimeExceededError

Represents a client error that occurred exceeding maximum wait time

ReadingInboundRequestBodyError

Represents a listener error that occurred while writing the inbound request entity body

ReadingInboundRequestHeadersError

Represents a listener error that occurred while reading inbound request headers

ReadingInboundResponseBodyError

Represents a client error that occurred while reading inbound response entity body

ReadingInboundResponseHeadersError

Represents a client error that occurred while reading inbound response headers

SslError

Represents a client error that occurred due to SSL failure

UnsupportedActionError

Represents a client error that occurred due to unsupported action invocation

UpstreamServiceUnavailableError

Represents a client error that occurred due to upstream service unavailability

Writing100ContinueResponseError

Represents an error that occurred while writing 100 continue response

WritingOutboundRequestBodyError

Represents a client error that occurred while writing outbound request entity body

WritingOutboundRequestHeadersError

Represents a client error that occurred while writing outbound request headers

WritingOutboundResponseBodyError

Represents a listener error that occurred while writing outbound response entity body

WritingOutboundResponseHeadersError

Represents a listener error that occurred while writing outbound response headers

WsConnectionClosureError

Raised during failures in connection closure

WsConnectionError

Raised during connection failures

WsGenericError

Raised for errors not captured by the specific errors

WsInvalidContinuationFrameError

Raised when an out of order/invalid continuation frame is received

WsInvalidHandshakeError

Raised during the handshake when the WebSocket upgrade fails

WsPayloadTooBigError

Raised when receiving a frame with a payload exceeding the maximum size

WsProtocolError

Raised when the other side breaks the protocol