Package org.refcodes.rest
What is this package for?
With this artifact you easily create you RESTful servers and REST clients. Therefcodes-rest
artifact lets you do it the
Bare-Metal
way, or the syntactic sugar
(see
client sugar
or server sugar
) way (meaning the use
of statically imported methods):
RESTful server
- Instantiate the RESTful server
- Register your lambda expressions
- Start the RESTful server
Java
based RESTful
server. Below, you see the three steps with the
help of a little syntactic sugar
:
// STEP 1: We use a singleton with syntactic sugar instead of instantiating a HttpRestServer:
import static org.refcodes.rest.HttpRestServerSugar.*;
...
public static void main( String[] args ) {
// STEP 2: Using syntactic sugar, we register our lambda expression:
onGet( "/say/${name}=*", ( aResponse ) -> {
String name = aResponse.getWildcardReplacement( "name" );
aResponse.getHeaderFields().withContentType( MediaType.APPLICATION_JSON ).withAddCookie( "greeting", "Hello " + name + "!" );
return "Hello " + name + "!" ;
} ).open();
// STEP 3: We open the HttpRestServer singleton on port 8080 using our syntactic sugar:
open( 8080 );
}
...
The
TinyRestfulServer demo application uses syntactic sugar
for
setting up a RESTful
server including command line arguments
parsing.
REST client
- Instantiate the REST client
- Register your lambda expressions
- Fire the client's REST request
Java
based REST
client. Below you see the three
steps with the help of a little syntactic sugar
:
// STEP 1: We use a singleton with syntactic sugar instead of instantiating a HttpRestClient:
import static org.refcodes.rest.HttpRestClientSugar.*;
...
public static void main( String[] args ) {
// STEP 2: Using syntactic sugar, we define our caller, including the response listener:
doGet( "http://mydomain:8080/say", ( aResponse ) -> {
... = aResponse.getResponse( SomeType.class );
} ).withRequest( ... ).open();
// STEP 3: We opened the caller so it fires the request to port 8080 of domain "mydomain"
}
...
How do I get set up?
To get up and running, include the following dependency (without the three dots "...") in yourpom.xml
:
<dependencies>
...
<dependency>
<artifactId>refcodes-rest</artifactId>
<groupId>org.refcodes</groupId>
<version>x.y.z</version>
</dependency>
...
</dependencies>
(please refer to Maven Central at
"http://search.maven.org/#search|ga|1|g%3A%22org.refcodes%22" for the most
current version)
If you want the framework to interoperate with SLF4J
(http://www.slf4j.org/) logging, you may instead add the following
dependencies to your pom.xml
:
<dependencies>
...
<dependency>
<artifactId>refcodes-rest</artifactId>
<groupId>org.refcodes</groupId>
<version>x.y.z</version>
</dependency>
<dependency>
<groupId>org.refcodes</groupId>
<artifactId>refcodes-logger-alt-slf4j</artifactId>
<version>x.y.z</version>
</dependency>
...
</dependencies>
(please refer to Maven Central at
"http://search.maven.org/#search|ga|1|g%3A%22org.refcodes%22" for the most
current version)
The artifact is hosted directly at Maven Central (http://search.maven.org). Jump straight to the source codes at Bitbucket (https://bitbucket.org/refcodes/refcodes-rest). Read the artifact's javadoc at javadoc.io (http://www.javadoc.io/doc/org.refcodes/refcodes-rest).
How do I get started with the RESTful server?
Above you saw an example on how to setup your ownRESTful
service using syntactic sugar
. One drawback of using
syntactic sugar
is that we can only make use of the one
HttpRestServerSingleton
(as of this
syntactic sugar
being the statically imported methods),
preventing us from running multiple HttpRestServer
instances on different ports in one Java
application.
Lets do it the Bare-Metal
way, which is not very complicated
either, and which lets us instantiate as many
HttpRestServer
instances as we want:
...
public static void main( String[] args ) {
// STEP 1: We instantiate our HttpRestServer:
HttpRestServer theRestServer = new HttpRestServerImpl();
// STEP 2: We register our lambda expression:
theRestServer.onGet( "/say/${name}=*", ( aResponse ) -> {
String name = aResponse.getWildcardReplacement( "name" );
aResponse.getHeaderFields().withContentType( MediaType.APPLICATION_JSON ).withAddCookie( "greeting", "Hello " + name + "!" );
return "Hello " + name + "!" ;
} ).open();
// STEP 3: We open the HttpRestServer instance on port 8080:
theRestServer.open( 8080 );
}
...
The Locator-Pattern
Did you notice the Locator-Pattern"/say/${name}=*"
above when
registering your lambda
? Subscribing your lambda
expressions for incoming REST
requests on specific
locators
, you may use a common wildcard
syntax to
define the lambda
's locator pattern
:
- A single asterisk ("*") matches zero or more characters within a locator name.
- A double asterisk ("**") matches zero or more characters across directory levels.
- A question mark ("?") matches exactly one character within a locator name.
*
), the double asterisk (**
)
and the question mark (?
) we refer to as wildcard
:
You get an array with all the substitutes of the wildcards
using
the method RestRequestEvent#getWildcardReplacements()
.
You may name a wildcard
by prefixing it with
"${someWildcardName}=
". For example a named
wildcard
may look as follows: "${arg1}=*
" or
"${arg2}=**
" or "${arg3}=?
" or as of the example
above "/say/${name}=*"
. When your "lambda
" is being
invoked, you can retrieve the wildcard
substitution by the name
of the wildcard
which has been substituted (by parts of the
incoming locator). You can get the text substituting a named
wildcard
using the method
RestRequestEvent#getWildcardReplacement(String)
.
The RESTful server's bits and pieces
RestServer
: It acts as the target for clients issuing REST requests.RestEndpointBuilder
) instances, most easily being created with the RestServer#subscribeObserver(HttpMethod, String, RestRequestObserver) or the like methods, are registered as listeners to theRestServer
. TheRestServer
firesRestRequestEvent
events to theRestRequestObserver
s of aRestEndpoint
dedicated to an according locator(pattern) for a specificHttpMethod
.HttpRestServer
: It extends aRestServer
to be capable of opening a server socket on the local host with the provided port number via #open(Integer) or with an additional maximum number of connections via #open(Integer, int) . AHttpRestServer
can be shutdown via #close().HttpRestServerImpl
: Implementation of theHttpRestServer
interface using the HttpServer defined in the com.sun.net.httpserver artifact. TheHttpRestServer
can also be implemented with other HTTP servers under the hood, use theAbstractRestServer
as super class of your own implementation to easily do so.RestEndpoint
: ARestEndpoint
subscribes to aRestServer
) and defines the target for a REST request. Therefore theRestEndpoint
describes theHttpMethod
, the locator (pattern) to which to respond as well as aRestRequestObserver
responsible for processing the request. TheRestRequestObserver
is invoked as soon as a request with the givenHttpMethod
for a locator matching the given Locator-Pattern is being processed by theRestServer
).RestEndpointBuilder
): ARestEndpointBuilder
) extends aRestEndpoint
with builder functionality and adds lambda support for handling the request addressed to thisRestEndpoint
. The lambda defined asRestRequestObserver
acts as the single listener to thisRestEndpoint
responsible for handling the request for which thisRestEndpoint
is responsible.RestRequestObserver
: It can be coded using the lambda syntax and processes a request on a given locator for a givenHttpMethod
. TheRestRequestObserver
is working with a context (theRestRequestEvent
).HttpRestServerSugar
: The syntactic sugar for setting up your RESTful service as quickly as possible ("import static org.refcodes.rest.HttpRestServerSugar.*;").
How do I get started with the REST client?
Above you saw an example on how to setup your ownREST
client
using syntactic sugar
. One drawback of using
syntactic sugar
is that we can only make use of the one
HttpRestClientSingleton
(as of this
syntactic sugar
being the statically imported methods),
preventing us from running multiple HttpRestClient
instances in one Java
application (which is actually no real
drawback, as the HttpRestClientSingleton
can fire
at any HTTP or HTTPS targets you wish to connect to).
Lets do it the Bare-Metal
way, which is not very complicated
either, and which lets us instantiate as many
HttpRestClient
instances as we want:
...
public static void main( String[] args ) {
// STEP 1: We instantiate our HttpRestClient:
HttpRestClient theRestClient = new HttpRestClientImpl();
// STEP 2: We register our lambda expression:
theRestClient.doRequest( HttpMethod.POST, "http://mydomain:8080/say", ( aResponse ) -> {
String theResponse = aResponse.getResponse( String.class );
} ).withRequest( ... ).open();
// STEP 3: We opened the caller so it fires the request to port 8080 of domain "mydomain"
}
...
The REST client's bits and pieces
RestClient
: It acts as the origin for clients issuing REST requests.RestCallerBuilder
instances, most easily being created with the RestClient#doRequest( HttpMethod , aLocator, aResponseObserver ) or the like methods, are registered as listeners to theRestClient
's request, waiting for the response. TheRestClient
firesRestResponseEvent
events to theRestResponseObserver
of theRestCaller
dedicated to the according request.HttpRestClient
: It extends aRestClient
to be capable of doing HTTP (HTTPS). AHttpRestClient
can be shutdown via #close().HttpRestClientImpl
: Implementation of theHttpRestClient
interface using the HttpURLConnection (https://docs.oracle.com/javase/8/docs/api/java/net/HttpURLConnection.html) defined in the java.net package. TheHttpRestClient
can also be implemented with other HTTP connectors under the hood, use theAbstractRestClient
as super class of your own implementation to easily do so.RestCaller
: ARestCaller
subscribes to aRestClient
(HttpRestClient
)'s request and defines the target for a REST request's response. Therefore theRestCaller
describes theRestResponseObserver
responsible for processing the request's response. TheRestResponseObserver
is invoked as soon as a response for the according request is being received by theRestClient
(HttpRestClient
).RestCallerBuilder
: ARestCallerBuilder
extends aRestCaller
with builder functionality and adds lambda support for handling the responses addressed to thisRestCaller
. The lambda defined as RequestObserver acts as the single listener to thisRestCaller
responsible for handling the response for which thisRestCaller
is responsible.RestResponseObserver
: It can be coded using the lambda syntax and processes a request's response. TheRestResponseObserver
is working with a context (theRestResponseEvent
).HttpRestClientSugar
: The syntactic sugar for setting up your REST client as quickly as possible ("import static org.refcodes.rest.HttpRestClientSugar.*;").
Examples
Please refer to the example code at "https://bitbucket.org/refcodes/refcodes-rest/src/master/src/test/java/org/refcodes/rest". Also see "https://bitbucket.org/refcodes/refcodes-rest/src/master/src/test/java/org/refcodes/rest"-
Interface Summary Interface Description BasicAuthEndpoint ABasicAuthEndpoint
subscribes to aRestServer
(HttpRestServer
) and defines the target for a Basic-Auth request.BasicAuthEndpointBuilder ABasicAuthEndpointBuilder
extends anBasicAuthEndpoint
with builder functionality and addslambda
support for handling the requests addressed to thisBasicAuthEndpoint
.BasicAuthEvent Defines aBasicAuthEvent
being the request as consumed by aRestEndpoint
.HomePathAccessor Provides an accessor for a home path property.HomePathAccessor.HomePathBuilder<B extends HomePathAccessor.HomePathBuilder<?>> Provides a mutator for an home path property.HomePathAccessor.HomePathMutator Provides a mutator for a home path property.HomePathAccessor.HomePathProperty Provides a home path property.HomeRequestObserver Mixin to register aRestRequestObserver
upon "home" requests.HomeRequestObserverAccessor Provides an accessor for a homeRestRequestObserver
property.HomeRequestObserverAccessor.HomeRequestObserverBuilder<B extends HomeRequestObserverAccessor.HomeRequestObserverBuilder<B>> Provides a builder method for a homeRestRequestObserver
property returning the builder for applying multiple build operations.HomeRequestObserverAccessor.HomeRequestObserverMutator Provides a mutator for a homeRestRequestObserver
property.HomeRequestObserverAccessor.HomeRequestObserverProperty Provides a homeRestRequestObserver
property.HomeUrlAccessor Provides an accessor for a homeUrl
property.HomeUrlAccessor.HomeUrlBuilder<B extends HomeUrlAccessor.HomeUrlBuilder<?>> Provides a mutator for an homeUrl
property.HomeUrlAccessor.HomeUrlMutator Provides a mutator for a homeUrl
property.HomeUrlAccessor.HomeUrlProperty 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.HttpDiscoveryContext This context describes all information required to register a server ("service") at a service discovery registry.HttpDiscoveryContext.HttpDiscoveryContextBuilder TheHttpDiscoveryContext.HttpDiscoveryContextBuilder
interface extends 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.HttpDiscoveryUrlAccessor 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.HttpDiscoveryUrlAccessor.HttpDiscoveryUrlMutator Provides a mutator for a service discovery discovery URL property.HttpDiscoveryUrlAccessor.HttpDiscoveryUrlProperty Provides a service discovery discovery URL property.HttpExceptionHandler A lambda "catch-all" for handling exceptions during HTTP-Request processing.HttpExceptionHandlerAccessor 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.HttpExceptionHandlerAccessor.HttpExceptionHandlerMutator Extends theHttpExceptionHandlerAccessor
with a setter method.HttpExceptionHandlerAccessor.HttpExceptionHandlerProperty Extends theHttpExceptionHandlerAccessor
with a setter method.HttpExceptionHandlingAccessor 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.HttpExceptionHandlingAccessor.HttpExceptionHandlingMutator Extends theHttpExceptionHandlingAccessor
with a setter method.HttpExceptionHandlingAccessor.HttpExceptionHandlingProperty Extends theHttpExceptionHandlingAccessor
with a setter method.HttpRegistry<DESC extends HttpServerDescriptor,B extends HttpRegistry<DESC,B>> 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.HttpRegistryContext.HttpRegistryContextBuilder<DESC extends HttpServerDescriptor> TheHttpRegistryContext.HttpRegistryContextBuilder
interface extends theHttpRegistryContext
with builder functionality as of the builder pattern.HttpRegistryRestServer<DESC extends HttpServerDescriptor,B extends HttpRegistryRestServer<DESC,B>> 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.HttpRegistrySidecar<DESC extends HttpServerDescriptor,B extends HttpRegistrySidecar<DESC,B>> TheHttpRegistrySidecar
describes the functionality required in order to register a service at a service registry and discovery service.HttpRegistryUrlAccessor 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.HttpRegistryUrlAccessor.HttpRegistryUrlMutator Provides a mutator for a service registry registry URL property.HttpRegistryUrlAccessor.HttpRegistryUrlProperty Provides a service registry registry URL property.HttpRestClient 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)
(BaseUrlAccessor.BaseUrlBuilder.withBaseUrl(String)
).HttpRestServer 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)
.HttpServerDescriptor 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.HttpServerDescriptorAccessor.HttpServerDescriptorMutator<DESC extends HttpServerDescriptor> Provides a mutator for aHttpServerDescriptor
property.HttpServerDescriptorAccessor.HttpServerDescriptorProperty<DESC extends HttpServerDescriptor> Provides aHttpServerDescriptor
property.HttpServerDescriptorFactory<DESC extends HttpServerDescriptor> TheHttpServerDescriptorFactory
provides factory functionality for creatingHttpServerDescriptor
instances.LoopbackRestClient Extends aRestClient
to be used as loopback device e.g. for testing purposes such as testing yourRestResponseObserver
implementations.LoopbackRestServer Extends aRestServer
to be used as loopback device e.g. for testing purposes such as testing yourRestRequestObserver
implementations.PingPathAccessor Provides an accessor for a ping path property.PingPathAccessor.PingPathBuilder<B extends PingPathAccessor.PingPathBuilder<?>> Provides a mutator for an ping path property.PingPathAccessor.PingPathMutator Provides a mutator for a ping path property.PingPathAccessor.PingPathProperty Provides a ping path property.PingRequestObserver Mixin to register aRestRequestObserver
upon "ping" requests.PingRequestObserverAccessor Provides an accessor for a pingRestRequestObserver
property.PingRequestObserverAccessor.PingRequestObserverBuilder<B extends PingRequestObserverAccessor.PingRequestObserverBuilder<B>> Provides a builder method for a pingRestRequestObserver
property returning the builder for applying multiple build operations.PingRequestObserverAccessor.PingRequestObserverMutator Provides a mutator for a pingRestRequestObserver
property.PingRequestObserverAccessor.PingRequestObserverProperty Provides a pingRestRequestObserver
property.PingUrlAccessor Provides an accessor for a pingUrl
property.PingUrlAccessor.PingUrlBuilder<B extends PingUrlAccessor.PingUrlBuilder<?>> Provides a mutator for an pingUrl
property.PingUrlAccessor.PingUrlMutator Provides a mutator for a pingUrl
property.PingUrlAccessor.PingUrlProperty Provides a pingUrl
property.RestCaller ARestCaller
describes a REST request and theRestResponseObserver
in charge for handling the response.RestCallerBuilder AnRestCallerBuilder
extends anRestCaller
with builder functionality and addslambda
support for handling the responses addressed to thisRestCaller
.RestClient A client to send requests for communicating with a RESTful server such as theHttpRestServer
.RestDeleteClient Helper interface to keep the huge amount of convenience methods under control.RestEndpoint AnRestEndpoint
subscribes to aRestServer
(HttpRestServer
) and defines the target for a REST request.RestEndpointBuilder AnRestEndpointBuilder
extends anRestEndpoint
with builder functionality and addslambda
support for handling the requests addressed to thisRestEndpoint
.RestGetClient Helper interface to keep the huge amount of convenience methods under control.RestPostClient Helper interface to keep the huge amount of convenience methods under control.RestPutClient Helper interface to keep the huge amount of convenience methods under control.RestRequest ARestRequest
describes a REST request and theRestResponse
providing the response.RestRequestBuilder AnRestRequestBuilder
extends anRestCaller
with builder functionality and addslambda
support for handling the responses addressed to thisRestCaller
.RestRequestClient Helper interface to keep the huge amount of convenience methods under control.RestRequestEvent Defines aRestRequestEvent
being the request as consumed by aRestEndpoint
.RestRequestHandler 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).RestRequestObserver TheRestRequestObserver
can be coded using thelambda
syntax and processes a request for a given locator and for a givenHttpMethod
.RestResponse Defines aRestResponse
being the base definition of a response as returned as of a request issued by aRestClient
(HttpRestClient
).RestResponseEvent RestResponseObserver TheRestResponseObserver
can be coded using thelambda
syntax and processes a response from a server.RestServer TheRestServer
acts as the target for clients issuing REST requests.StatusPathAccessor Provides an accessor for a status path property.StatusPathAccessor.StatusPathBuilder<B extends StatusPathAccessor.StatusPathBuilder<?>> Provides a mutator for an status path property.StatusPathAccessor.StatusPathMutator Provides a mutator for a status path property.StatusPathAccessor.StatusPathProperty Provides a status path property.StatusRequestObserver Mixin to register aRestRequestObserver
upon "status" requests.StatusRequestObserverAccessor Provides an accessor for a statusRestRequestObserver
property.StatusRequestObserverAccessor.StatusRequestObserverBuilder<B extends StatusRequestObserverAccessor.StatusRequestObserverBuilder<B>> Provides a builder method for a statusRestRequestObserver
property returning the builder for applying multiple build operations.StatusRequestObserverAccessor.StatusRequestObserverMutator Provides a mutator for a statusRestRequestObserver
property.StatusRequestObserverAccessor.StatusRequestObserverProperty Provides a statusRestRequestObserver
property.StatusUrlAccessor Provides an accessor for a statusUrl
property.StatusUrlAccessor.StatusUrlBuilder<B extends StatusUrlAccessor.StatusUrlBuilder<?>> Provides a mutator for an statusUrl
property.StatusUrlAccessor.StatusUrlMutator Provides a mutator for a statusUrl
property.StatusUrlAccessor.StatusUrlProperty Provides a statusUrl
property. -
Class Summary Class Description AbstractHttpDiscoveryRestClientDecorator<B extends HttpDiscoveryRestClient<B>> Abstract class for easily decorating aHttpDiscoveryRestClient
.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
.AbstractRestClient Abstract base implementation of theRestClient
interface being the foundation for variousRestClient
implementations such asHttpRestClientImpl
orLoopbackRestClientImpl
.AbstractRestServer Implementation of the base functionality of theRestServer
interface omitting the HTTP handling part being the foundation for variousRestServer
implementations such asHttpRestServerImpl
orLoopbackRestServerImpl
.BasicAuthEndpointBuilderImpl The implementation of theBasicAuthEndpointBuilder
interface as good old POJO for use by differentRestServer
implementations.BasicAuthEventImpl TheBasicAuthEventImpl
class implements theBasicAuthEvent
type.HttpDiscoveryContextBuilderImpl HttpRestClientImpl TheHttpRestClientImpl
implements theHttpRestClient
interface.HttpRestClientSingleton The singleton of theHttpRestClientImpl
for easyHttpRestClient
access.HttpRestClientSugar Declarative syntactic sugar which may be statically imported in order to allow declarative definitions of REST client functionality:import static org.refcodes.rest.HttpRestClientSugar.*;
HttpRestServerImpl Implementation of theHttpRestServer
interface using theHttpServer
defined in thecom.sun.net.httpserver
package.HttpRestServerSingleton The singleton of theHttpRestServerImpl
for easyHttpRestServer
access.HttpRestServerSugar Declarative syntactic sugar which may be statically imported in order to allow declarative definitions of RESTful server functionality:import static org.refcodes.rest.HttpRestServerSugar
LoopbackRestClientImpl Implementation if theLoopbackRestClient
for easy testing of your requests being issued with aRestClient
(HttpRestClient
) and the according responselambda
expressions.LoopbackRestClientSingleton The singleton of theLoopbackRestClientImpl
for easyLoopbackRestClientImpl
access.LoopbackRestServerImpl Implementation if theLoopbackRestServer
for easy testing of your requests being received by aRestServer
(HttpRestServer
) and the according responselambda
expressions.LoopbackRestServerSingleton The singleton of theLoopbackRestServerImpl
for easyRestServer
access.OauthTokenHandler Self refreshing implementation of theOauthToken
.RestCallerBuilderImpl The implementation of theRestCallerBuilder
interface as good old POJO for use by differentRestClient
implementations.RestDeleteClientSugar Helper class to get the syntactic sugar (from a maintenance point of view) under control.RestEndpointBuilderImpl The implementation of theRestEndpointBuilder
interface as good old POJO for use by differentRestServer
implementations.RestGetClientSugar Helper class to get the syntactic sugar (from a maintenance point of view) under control.RestPostClientSugar Helper class to get the syntactic sugar (from a maintenance point of view) under control.RestPutClientSugar Helper class to get the syntactic sugar (from a maintenance point of view) under control.RestRequestBuilderImpl The implementation of theRestCallerBuilder
interface as good old POJO for use by differentRestClient
implementations.RestRequestClientSugar Helper class to get the syntactic sugar (from a maintenance point of view) under control.RestRequestEventImpl Implementation of theRestRequestEvent
interface as good old POJO for use by differentRestServer
implementations.RestResponseEventImpl Implementation of theRestResponseEvent
interface as good old POJO for use by differentRestClient
implementations.RestResponseImpl Implementation of theRestResponseEvent
interface as good old POJO for use by differentRestClient
implementations. -
Enum Summary Enum Description HttpExceptionHandling Defines how errors affect the HTTP-Body whilst processing aHttpRequest
or aHttpResponse
along with the according sub-classes.