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.MediaTypeFactoryLookup.MutableMediaTypeFactoryLookup
org.refcodes.net.RealmAccessor.RealmBuilder<B extends org.refcodes.net.RealmAccessor.RealmBuilder<B>>, org.refcodes.net.RealmAccessor.RealmMutator, org.refcodes.net.RealmAccessor.RealmProperty
org.refcodes.net.BaseLocatorAccessor.BaseLocatorBuilder<B extends org.refcodes.net.BaseLocatorAccessor.BaseLocatorBuilder<B>>, org.refcodes.net.BaseLocatorAccessor.BaseLocatorMutator, org.refcodes.net.BaseLocatorAccessor.BaseLocatorProperty
_hasRequestCorrelation, _hasSessionCorrelation
Constructor and Description |
---|
LoopbackRestServerImpl() |
Modifier and Type | Method and Description |
---|---|
org.refcodes.net.HttpServerResponse |
onHttpRequest(InetSocketAddress aLocalAddress,
InetSocketAddress aClientAddress,
org.refcodes.net.HttpMethod aHttpMethod,
org.refcodes.net.Url aUrl,
org.refcodes.net.RequestHeaderFields aRequestHeaderFields,
InputStream aHttpInputStream)
Extensions of this class disect an incoming request and pass it to this
method for doing the actual invocation of the registered
RestEndpoint instances. |
org.refcodes.net.HttpServerResponse |
onHttpRequest(InetSocketAddress aLocalAddress,
InetSocketAddress aClientAddress,
org.refcodes.net.HttpMethod aHttpMethod,
org.refcodes.net.Url aUrl,
org.refcodes.net.RequestHeaderFields aRequestHeaderFields,
String aHttpBody)
Invoke this method to simulate a REST request to be handled by the
according registered
RestEndpoint instances: |
addMediaTypeFactory, dispose, doRequestCorrelation, doSessionCorrelation, fireEvent, getBaseLocator, getFactoryMediaTypes, getRealm, hasRequestCorrelation, hasSessionCorrelation, initMedaTypeFactories, isObserversActive, observers, setBaseLocator, setObserversActive, setRealm, setRequestCorrelation, setSessionCorrelation, subscribeObserver, toMediaTypeFactory, toNegotiatedContenType, toResponseBody, unsubscribeObserver
clear, doHandleEventListenerException, fireEvent, getThreadPriority, hasObserverSubscription, isEmpty, setThreadPriority, size
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
withBaseLocator, withRealm
onDelete, onGet, onPost, onPut, onRequest, onRequest, onRequest, withDisableObservers, withDisableRequestCorrelation, withDisableSessionCorrelation, withEnableObservers, withEnableRequestCorrelation, withEnableSessionCorrelation, withObserversActive, withRequestCorrelation, withSessionCorrelation
hasObserverSubscription, subscribeObserver, unsubscribeObserver
disableObservers, enableObservers, isObserversActive, observers, setObserversActive
addMediaTypeFactory
getFactoryMediaTypes, hasMediaTypeFactory, toMediaTypeFactory
setBaseLocator
public org.refcodes.net.HttpServerResponse onHttpRequest(InetSocketAddress aLocalAddress, InetSocketAddress aClientAddress, org.refcodes.net.HttpMethod aHttpMethod, org.refcodes.net.Url aUrl, org.refcodes.net.RequestHeaderFields aRequestHeaderFields, InputStream aHttpInputStream) 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.HttpServerResponse
instance to by 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 org.refcodes.net.HttpServerResponse onHttpRequest(InetSocketAddress aLocalAddress, InetSocketAddress aClientAddress, org.refcodes.net.HttpMethod aHttpMethod, org.refcodes.net.Url aUrl, org.refcodes.net.RequestHeaderFields aRequestHeaderFields, String aHttpBody) 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.HttpServerResponse
containing the complete result of
processing the request.org.refcodes.net.HttpStatusException
- the http status exceptionCopyright © 2018. All rights reserved.