Module org.refcodes.rest
Package org.refcodes.rest
package org.refcodes.rest
With this artifact you easily create your serverless RESTful services and
REST clients. It lets you do it the Bare-Metal way or the syntactic sugar
(see HttpRestClientSugar
or HttpRestServerSugar)
way (being the use of statically imported methods).
Please refer to the refcodes-rest: RESTful services using lambdas documentation for an up-to-date and detailed description on the usage of this artifact.
-
ClassDescriptionAbstract class for easily decorating a
HttpDiscoveryRestClient
.AbstractHttpDiscoverySidecar<B extends HttpDiscoverySidecar<B>>Abstract class for easily decorating aHttpRegistrySidecar
.AbstractHttpRegistryContextBuilder<DESC extends HttpServerDescriptor>AbstractHttpRegistryRestServerDecorator<DESC extends HttpServerDescriptor,B extends HttpRegistryRestServer<DESC, B>> Abstract class for easily decorating aHttpRegistryRestServer
.AbstractHttpRegistrySidecar<DESC extends HttpServerDescriptor,B extends HttpRegistrySidecar<DESC, B>> Abstract class for easily decorating aHttpRegistrySidecar
.AbstractHttpRestClientDecorator<B extends HttpRestClient>Abstract class for easily decorating aHttpRestClient
.AbstractHttpRestServerDecorator<B extends HttpRestServer>Abstract class for easily decorating aHttpRestServer
.Abstract base implementation of theRestClient
interface being the foundation for variousRestClient
implementations such asHttpRestClientImpl
orLoopbackRestClientImpl
.Implementation of the base functionality of theRestServer
interface omitting the HTTP handling part being the foundation for variousRestServer
implementations such asHttpRestServerImpl
orLoopbackRestServerImpl
.ABasicAuthEndpoint
subscribes to aRestServer
(HttpRestServer
) and defines the target for a Basic-Auth request.ABasicAuthEndpointBuilder
extends anBasicAuthEndpoint
with builder functionality and addslambda
support for handling the requests addressed to thisBasicAuthEndpoint
.Provides an accessor for a home path property.Provides a mutator for an home path property.Provides a mutator for a home path property.Provides a home path property.Mixin to register aRestRequestConsumer
upon "home" requests.Provides an accessor for a homeRestRequestConsumer
property.HomeRequestObserverAccessor.HomeRequestObserverBuilder<B extends HomeRequestObserverAccessor.HomeRequestObserverBuilder<B>>Provides a builder method for a homeRestRequestConsumer
property returning the builder for applying multiple build operations.Provides a mutator for a homeRestRequestConsumer
property.Provides a homeRestRequestConsumer
property.Provides an accessor for a homeUrl
property.HomeUrlAccessor.HomeUrlBuilder<B extends HomeUrlAccessor.HomeUrlBuilder<?>>Provides a mutator for an homeUrl
property.Provides a mutator for a homeUrl
property.Provides a homeUrl
property.HttpDiscovery<B extends HttpDiscovery<B>>TheHttpDiscovery
describes the functionality required in order to discover a service at a service discovery and discovery service.This context describes all information required to register a server ("service") at a service discovery registry.TheHttpDiscoveryContextBuilder
implements theHttpDiscoveryContext
with builder functionality as of the builder pattern.HttpDiscoveryRestClient<B extends HttpDiscoveryRestClient<B>>TheHttpDiscoveryRestClient
provides additional functionality for registering at and signing off from a service discovery service in order to resolve URLs to or from other services.HttpDiscoverySidecar<B extends HttpDiscoverySidecar<B>>TheHttpDiscoverySidecar
describes the functionality required in order to discover a service at a service discovery and discovery service.Provides an accessor for a service discovery discoveryUrl
property.HttpDiscoveryUrlAccessor.HttpDiscoveryUrlBuilder<B extends HttpDiscoveryUrlAccessor.HttpDiscoveryUrlBuilder<B>>Provides a builder method for a service discovery discovery URL property returning the builder for applying multiple build operations.Provides a mutator for a service discovery discovery URL property.Provides a service discovery discovery URL property.A lambda "catch-all" for handling exceptions during HTTP-Request processing.Provides access to aHttpExceptionHandler
property.HttpExceptionHandlerAccessor.HttpExceptionHandlerBuilder<B extends HttpExceptionHandlerAccessor.HttpExceptionHandlerBuilder<B>>Provides a builder method for aHttpExceptionHandler
property returning the builder for applying multiple build operations.Extends theHttpExceptionHandlerAccessor
with a setter method.Extends theHttpExceptionHandlerAccessor
with a setter method.Defines how errors affect the HTTP-Body whilst processing aHttpRequest
or aHttpResponse
along with the according sub-classes.Provides access to aHttpExceptionHandling
property.HttpExceptionHandlingAccessor.HttpExceptionHandlingBuilder<B extends HttpExceptionHandlingAccessor.HttpExceptionHandlingBuilder<B>>Provides a builder method for aHttpExceptionHandling
property returning the builder for applying multiple build operations.Extends theHttpExceptionHandlingAccessor
with a setter method.Extends theHttpExceptionHandlingAccessor
with a setter method.TheHttpRegistry
describes the functionality required in order to register a service at a service registry and discovery service.HttpRegistryContext<DESC extends HttpServerDescriptor>This context describes all information required to register a server ("service") at a service discovery registry.TheHttpRegistryContext.HttpRegistryContextBuilder
interface extends theHttpRegistryContext
with builder functionality as of the builder pattern.TheHttpRegistryRestServer
provides additional functionality for registering at and signing off from a service discovery service in order to resolve URLs to or from other services.TheHttpRegistrySidecar
describes the functionality required in order to register a service at a service registry and discovery service.Provides an accessor for a service registry registryUrl
property.HttpRegistryUrlAccessor.HttpRegistryUrlBuilder<B extends HttpRegistryUrlAccessor.HttpRegistryUrlBuilder<B>>Provides a builder method for a service registry registry URL property returning the builder for applying multiple build operations.Provides a mutator for a service registry registry URL property.Provides a service registry registry URL property.Extends aRestClient
to be capable of providing a User-Agent withUserAgentAccessor.UserAgentMutator.setUserAgent(String)
(HttpRestClient.withUserAgent(String)
) and to be capable of using base URLs to be set withBaseUrlAccessor.BaseUrlMutator.setBaseUrl(String)
(HttpRestClient.withBaseUrl(String)
).TheHttpRestClientImpl
implements theHttpRestClient
interface.The singleton of theHttpRestClientImpl
for easyHttpRestClient
access.Declarative syntactic sugar which may be statically imported in order to allow declarative definitions of REST client functionality:import static org.refcodes.rest.HttpRestClientSugar.*;
Extends aRestServer
to be capable of opening a server socket on the local host with the provided port number viaConnectionOpenable.open(Object)
or with an additional maximum number of connections viaHttpRestServer.open(int, int)
.Implementation of theHttpRestServer
interface using theHttpServer
defined in thecom.sun.net.httpserver
package.The singleton of theHttpRestServerImpl
for easyHttpRestServer
access.Declarative syntactic sugar which may be statically imported in order to allow declarative definitions of RESTful server functionality:import static org.refcodes.rest.HttpRestServerSugar
TheHttpServerDescriptor
describes a server to be registered at a discovery registry so clients can resolve the server's URL.HttpServerDescriptor.HttpServerDescriptorBuilder<B extends HttpServerDescriptor.HttpServerDescriptorBuilder<B>>TheHttpServerDescriptor.HttpServerDescriptorBuilder
interface extends theHttpServerDescriptor
interface with builder functionality as of the builder pattern.HttpServerDescriptorAccessor<DESC extends HttpServerDescriptor>Provides an accessor for aHttpServerDescriptor
property.HttpServerDescriptorAccessor.HttpServerDescriptorBuilder<DESC extends HttpServerDescriptor,B extends HttpServerDescriptorAccessor.HttpServerDescriptorBuilder<DESC, B>> Provides a builder method for aHttpServerDescriptor
property returning the builder for applying multiple build operations.Provides a mutator for aHttpServerDescriptor
property.Provides aHttpServerDescriptor
property.HttpServerDescriptorFactory<DESC extends HttpServerDescriptor>TheHttpServerDescriptorFactory
provides factory functionality for creatingHttpServerDescriptor
instances.Extends aRestClient
to be used as loopback device e.g. for testing purposes such as testing yourRestResponseConsumer
implementations.Implementation if theLoopbackRestClient
for easy testing of your requests being issued with aRestClient
(LoopbackRestClientImpl
) and the according responselambda
expressions.The singleton of theLoopbackRestClientImpl
for easyLoopbackRestClientImpl
access.Extends aRestServer
to be used as loopback device e.g. for testing purposes such as testing yourRestRequestConsumer
implementations.Implementation if theLoopbackRestServer
for easy testing of your requests being received by aRestServer
(HttpRestServer
) and the according responselambda
expressions.The singleton of theLoopbackRestServerImpl
for easyRestServer
access.Self refreshing implementation of theOauthToken
.Provides an accessor for a ping path property.Provides a mutator for an ping path property.Provides a mutator for a ping path property.Provides a ping path property.Mixin to register aRestRequestConsumer
upon "ping" requests.Provides an accessor for a pingRestRequestConsumer
property.PingRequestObserverAccessor.PingRequestObserverBuilder<B extends PingRequestObserverAccessor.PingRequestObserverBuilder<B>>Provides a builder method for a pingRestRequestConsumer
property returning the builder for applying multiple build operations.Provides a mutator for a pingRestRequestConsumer
property.Provides a pingRestRequestConsumer
property.Provides an accessor for a pingUrl
property.PingUrlAccessor.PingUrlBuilder<B extends PingUrlAccessor.PingUrlBuilder<?>>Provides a mutator for an pingUrl
property.Provides a mutator for a pingUrl
property.Provides a pingUrl
property.A client to send requests for communicating with a RESTful server such as theHttpRestServer
.Helper interface to keep the huge amount of convenience methods under control.Helper class to get the syntactic sugar (from a maintenance point of view) under control.AnRestEndpoint
subscribes to aRestServer
(HttpRestServer
) and defines the target for a REST request.AnRestEndpointBuilder
extends anRestEndpoint
with builder functionality and addslambda
support for handling the requests addressed to thisRestEndpoint
.Helper interface to keep the huge amount of convenience methods under control.Helper class to get the syntactic sugar (from a maintenance point of view) under control.Helper interface to keep the huge amount of convenience methods under control.Helper class to get the syntactic sugar (from a maintenance point of view) under control.Helper interface to keep the huge amount of convenience methods under control.Helper class to get the syntactic sugar (from a maintenance point of view) under control.ARestRequest
describes a REST request and theRestResponse
providing the response.The implementation of theRestResponseHandler
interface as good old POJO for use by differentRestClient
implementations.Helper interface to keep the huge amount of convenience methods under control.Helper class to get the syntactic sugar (from a maintenance point of view) under control.TheRestRequestConsumer
can be coded using thelambda
syntax and processes a request for a given locator and for a givenHttpMethod
.Defines aRestRequestEvent
being the request as consumed by aRestEndpoint
.ARestRequestHandler
handles a REST request on theRestClient
instance's side to do the actual technical implementation of sending that request (or mocking the send-out of a request).Defines aRestResponse
being the base definition of a response as returned as of a request issued by aRestClient
(HttpRestClient
).TheRestResponseConsumer
can be coded using thelambda
syntax and processes a response from a server.Defines aRestResponseEvent
being the response as consumed by aRestResponseHandler
'sRestResponseConsumer
.ARestResponseHandler
describes a REST request and theRestResponseConsumer
in charge for handling a REST response.ARestResponseResult
handles a REST request asynchronously on theRestClient
instance's side to do the actual technical implementation of sending that request (or mocking the send-out of a request).TheRestServer
acts as the target for clients issuing REST requests.Provides an accessor for a status path property.Provides a mutator for an status path property.Provides a mutator for a status path property.Provides a status path property.Mixin to register aRestRequestConsumer
upon "status" requests.Provides an accessor for a statusRestRequestConsumer
property.StatusRequestObserverAccessor.StatusRequestObserverBuilder<B extends StatusRequestObserverAccessor.StatusRequestObserverBuilder<B>>Provides a builder method for a statusRestRequestConsumer
property returning the builder for applying multiple build operations.Provides a mutator for a statusRestRequestConsumer
property.Provides a statusRestRequestConsumer
property.Provides an accessor for a statusUrl
property.Provides a mutator for an statusUrl
property.Provides a mutator for a statusUrl
property.Provides a statusUrl
property.