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
Constructor and Description |
---|
LoopbackRestServerImpl() |
Modifier and Type | Method and Description |
---|---|
org.refcodes.net.HttpServerResponse |
onHttpRequest(InetSocketAddress aLocalAddress,
InetSocketAddress aClientAddress,
org.refcodes.net.HttpMethod aHttpMethod,
String aLocator,
String aQueryString,
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,
String aLocator,
String aQueryString,
org.refcodes.net.RequestHeaderFields aRequestHeaderFields,
String aHttpBody)
Invoke this method to simulate a REST request to be handled by the
according registered
Endpoint instances: |
addMediaTypeFactory, dispose, fireEvent, getBaseLocator, getFactoryMediaTypes, getRealm, initMedaTypeFactories, onRequest, setBaseLocator, setRealm, subscribeObserver, toMediaTypeFactory, 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
hasObserverSubscription, subscribeObserver, unsubscribeObserver
addMediaTypeFactory
public org.refcodes.net.HttpServerResponse onHttpRequest(InetSocketAddress aLocalAddress, InetSocketAddress aClientAddress, org.refcodes.net.HttpMethod aHttpMethod, String aLocator, String aQueryString, org.refcodes.net.RequestHeaderFields aRequestHeaderFields, InputStream aHttpInputStream) throws org.refcodes.net.HttpStatusException
AbstractRestServer
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.aLocator
- The locator (URL) targeted by the request (without the
query string).aQueryString
- The query string part of the request.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, String aLocator, String aQueryString, org.refcodes.net.RequestHeaderFields aRequestHeaderFields, String aHttpBody) throws org.refcodes.net.HttpStatusException
LoopbackRestServer
Endpoint
instances:onHttpRequest
in interface LoopbackRestServer
aHttpMethod
- The method for the simulated REST request to be usedaLocator
- The locator for the simulated REST request to be used
without the query string portion.aQueryString
- 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
Copyright © 2016. All rights reserved.