org.refcodes.mixin.Disposable
, org.refcodes.mixin.Loggable
, org.refcodes.net.BaseLocatorAccessor
, org.refcodes.net.BaseLocatorAccessor.BaseLocatorBuilder<RestServer>
, org.refcodes.net.BaseLocatorAccessor.BaseLocatorMutator
, org.refcodes.net.BaseLocatorAccessor.BaseLocatorProperty
, org.refcodes.net.MediaTypeFactoryLookup
, org.refcodes.net.MediaTypeFactoryLookup.MutableMediaTypeFactoryLookup
, org.refcodes.net.RealmAccessor
, org.refcodes.net.RealmAccessor.RealmBuilder<RestServer>
, org.refcodes.net.RealmAccessor.RealmMutator
, org.refcodes.net.RealmAccessor.RealmProperty
, org.refcodes.observer.Observable<RestEndpoint>
, org.refcodes.observer.Observers<RestEndpoint,RestServer>
, HttpExceptionHandlerAccessor
, HttpExceptionHandlerAccessor.HttpExceptionHandlerBuilder<RestServer>
, HttpExceptionHandlerAccessor.HttpExceptionHandlerMutator
, HttpExceptionHandlerAccessor.HttpExceptionHandlerProperty
, HttpExceptionHandlingAccessor
, HttpExceptionHandlingAccessor.HttpExceptionHandlingBuilder<RestServer>
, HttpExceptionHandlingAccessor.HttpExceptionHandlingMutator
, HttpExceptionHandlingAccessor.HttpExceptionHandlingProperty
, LoopbackRestServer
, RestServer
, org.refcodes.runtime.RequestCorrelation<RestServer>
, org.refcodes.runtime.SessionCorrelation<RestServer>
LoopbackRestServerSingleton
public class LoopbackRestServerImpl extends AbstractRestServer implements LoopbackRestServer
LoopbackRestServer
for easy testing of your
requests being received by a RestServer
(HttpRestServer
) and
the according response lambda
expressions.org.refcodes.net.BaseLocatorAccessor.BaseLocatorBuilder<B extends org.refcodes.net.BaseLocatorAccessor.BaseLocatorBuilder<B>>, org.refcodes.net.BaseLocatorAccessor.BaseLocatorMutator, org.refcodes.net.BaseLocatorAccessor.BaseLocatorProperty
org.refcodes.mixin.Disposable.Disposedable
HttpExceptionHandlerAccessor.HttpExceptionHandlerBuilder<B extends HttpExceptionHandlerAccessor.HttpExceptionHandlerBuilder<B>>, HttpExceptionHandlerAccessor.HttpExceptionHandlerMutator, HttpExceptionHandlerAccessor.HttpExceptionHandlerProperty
HttpExceptionHandlingAccessor.HttpExceptionHandlingBuilder<B extends HttpExceptionHandlingAccessor.HttpExceptionHandlingBuilder<B>>, HttpExceptionHandlingAccessor.HttpExceptionHandlingMutator, HttpExceptionHandlingAccessor.HttpExceptionHandlingProperty
_hasRequestCorrelation, _hasSessionCorrelation, _httpExceptionHandler, _httpExceptionHandling
Constructor | Description |
---|---|
LoopbackRestServerImpl() |
Modifier and Type | Method | Description |
---|---|---|
void |
onHttpRequest(InetSocketAddress aLocalAddress,
InetSocketAddress aClientAddress,
org.refcodes.net.HttpMethod aHttpMethod,
org.refcodes.net.Url aUrl,
org.refcodes.net.RequestHeaderFields aRequestHeaderFields,
InputStream aHttpInputStream,
org.refcodes.net.HttpServerResponse aHttpServerResponse) |
Extensions of this class disect an incoming request and pass it to this
method for doing the actual invocation of the registered
RestEndpoint instances. |
void |
onHttpRequest(InetSocketAddress aLocalAddress,
InetSocketAddress aClientAddress,
org.refcodes.net.HttpMethod aHttpMethod,
org.refcodes.net.Url aUrl,
org.refcodes.net.RequestHeaderFields aRequestHeaderFields,
String aHttpBody,
org.refcodes.net.HttpServerResponse aHttpServerResponse) |
Invoke this method to simulate a REST request to be handled by the
according registered
RestEndpoint instances: |
clear, doHandleEventListenerException, fireEvent, getThreadPriority, hasObserverSubscription, isEmpty, setThreadPriority, size
addMediaTypeFactory, dispose, doRequestCorrelation, doSessionCorrelation, fireEvent, getBaseLocator, getFactoryMediaTypes, getHttpExceptionHandler, getHttpExceptionHandling, getRealm, hasRequestCorrelation, hasSessionCorrelation, initMedaTypeFactories, isObserversActive, observers, setBaseLocator, setHttpExceptionHandler, setHttpExceptionHandling, setObserversActive, setRealm, setRequestCorrelation, setSessionCorrelation, subscribeObserver, toMediaTypeFactory, toNegotiatedContenType, toResponseBody, unsubscribeObserver
setBaseLocator
getHttpExceptionHandler
withOnHttpException
onHttpException, setHttpExceptionHandler
getHttpExceptionHandling
setHttpExceptionHandling
alert, alert, critical, critical, debug, error, info, notice, panic, trace, warn, warn
withBaseLocator, withHttpExceptionHandler, withHttpExceptionHandling, withRealm
getFactoryMediaTypes, hasMediaTypeFactory, toMediaTypeFactory
addMediaTypeFactory
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
hasObserverSubscription, subscribeObserver, unsubscribeObserver
disableObservers, enableObservers, isObserversActive, observers, setObserversActive
disableRequestCorrelation, enableRequestCorrelation, hasRequestCorrelation, setRequestCorrelation
onDelete, onGet, onPost, onPut, onRequest, onRequest, onRequest, withDisableObservers, withDisableRequestCorrelation, withDisableSessionCorrelation, withEnableObservers, withEnableRequestCorrelation, withEnableSessionCorrelation, withObserversActive, withRequestCorrelation, withSessionCorrelation
public void onHttpRequest(InetSocketAddress aLocalAddress, InetSocketAddress aClientAddress, org.refcodes.net.HttpMethod aHttpMethod, org.refcodes.net.Url aUrl, org.refcodes.net.RequestHeaderFields aRequestHeaderFields, InputStream aHttpInputStream, org.refcodes.net.HttpServerResponse aHttpServerResponse) throws org.refcodes.net.HttpStatusException
RestEndpoint
instances. An extension might call this method from
inside an event (request) handler.onHttpRequest
in interface LoopbackRestServer
onHttpRequest
in class AbstractRestServer
aLocalAddress
- The host and port of your REST service.aClientAddress
- The host and port for the caller.aHttpMethod
- The HttpMethod
of the request.aUrl
- The Url
from which to take the URL specific data.aRequestHeaderFields
- The Header-Fields (HeaderFields
)
belonging to the request.aHttpInputStream
- The body passed by the request.aHttpServerResponse
- A HttpServerResponse
instance to be
used by the extension to produce an according HTTP-Response.org.refcodes.net.HttpStatusException
- thrown in case of an RestEndpoint
responsible for the given request encountered a problem or none
RestEndpoint
felt responsible to produce a
HttpServerResponse
.public void onHttpRequest(InetSocketAddress aLocalAddress, InetSocketAddress aClientAddress, org.refcodes.net.HttpMethod aHttpMethod, org.refcodes.net.Url aUrl, org.refcodes.net.RequestHeaderFields aRequestHeaderFields, String aHttpBody, org.refcodes.net.HttpServerResponse aHttpServerResponse) throws org.refcodes.net.HttpStatusException
RestEndpoint
instances:onHttpRequest
in interface LoopbackRestServer
aLocalAddress
- the local addressaClientAddress
- the client addressaHttpMethod
- The method for the simulated REST request to be usedaUrl
- The query string part of the request.aRequestHeaderFields
- The simulated REST request's Header-Fields to
be usedaHttpBody
- The raw body for the simulated REST request to be used.aHttpServerResponse
- The HttpServerResponse
to be filled
with the complete result of processing the request.org.refcodes.net.HttpStatusException
- the http status exceptionCopyright © 2018. All rights reserved.