- All Superinterfaces:
org.refcodes.web.BaseLocatorAccessor,org.refcodes.web.BaseLocatorAccessor.BaseLocatorBuilder<RestServer>,org.refcodes.web.BaseLocatorAccessor.BaseLocatorMutator,org.refcodes.web.BaseLocatorAccessor.BaseLocatorProperty,HttpExceptionHandlerAccessor,HttpExceptionHandlerAccessor.HttpExceptionHandlerBuilder<RestServer>,HttpExceptionHandlerAccessor.HttpExceptionHandlerMutator,HttpExceptionHandlerAccessor.HttpExceptionHandlerProperty,HttpExceptionHandlingAccessor,HttpExceptionHandlingAccessor.HttpExceptionHandlingBuilder<RestServer>,HttpExceptionHandlingAccessor.HttpExceptionHandlingMutator,HttpExceptionHandlingAccessor.HttpExceptionHandlingProperty,org.refcodes.web.MediaTypeFactoryLookup,org.refcodes.web.MediaTypeFactoryLookup.MutableMediaTypeFactoryLookup,org.refcodes.observer.Observable<RestEndpoint>,org.refcodes.observer.Observers<RestEndpoint,,RestServer> org.refcodes.web.RealmAccessor,org.refcodes.web.RealmAccessor.RealmBuilder<RestServer>,org.refcodes.web.RealmAccessor.RealmMutator,org.refcodes.web.RealmAccessor.RealmProperty,org.refcodes.runtime.RequestCorrelation<RestServer>,RestServer,org.refcodes.runtime.SessionCorrelation<RestServer>
- All Known Implementing Classes:
LoopbackRestServerImpl,LoopbackRestServerSingleton
Extends a
RestServer to be used as loopback device e.g. for testing
purposes such as testing your RestRequestConsumer implementations.
Use the
onHttpRequest(InetSocketAddress, InetSocketAddress, HttpMethod, Url, RequestHeaderFields, InputStream, HttpServerResponse)
method to simulate REST requests on the LoopbackRestServer. An
registered RestEndpoint instances being targeted at will be invoked
accordingly.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.refcodes.web.BaseLocatorAccessor
org.refcodes.web.BaseLocatorAccessor.BaseLocatorBuilder<B extends org.refcodes.web.BaseLocatorAccessor.BaseLocatorBuilder<B>>, org.refcodes.web.BaseLocatorAccessor.BaseLocatorMutator, org.refcodes.web.BaseLocatorAccessor.BaseLocatorPropertyNested classes/interfaces inherited from interface org.refcodes.rest.HttpExceptionHandlerAccessor
HttpExceptionHandlerAccessor.HttpExceptionHandlerBuilder<B extends HttpExceptionHandlerAccessor.HttpExceptionHandlerBuilder<B>>, HttpExceptionHandlerAccessor.HttpExceptionHandlerMutator, HttpExceptionHandlerAccessor.HttpExceptionHandlerPropertyNested classes/interfaces inherited from interface org.refcodes.rest.HttpExceptionHandlingAccessor
HttpExceptionHandlingAccessor.HttpExceptionHandlingBuilder<B extends HttpExceptionHandlingAccessor.HttpExceptionHandlingBuilder<B>>, HttpExceptionHandlingAccessor.HttpExceptionHandlingMutator, HttpExceptionHandlingAccessor.HttpExceptionHandlingPropertyNested classes/interfaces inherited from interface org.refcodes.web.MediaTypeFactoryLookup
org.refcodes.web.MediaTypeFactoryLookup.MutableMediaTypeFactoryLookupNested classes/interfaces inherited from interface org.refcodes.web.RealmAccessor
org.refcodes.web.RealmAccessor.RealmBuilder<B extends org.refcodes.web.RealmAccessor.RealmBuilder<B>>, org.refcodes.web.RealmAccessor.RealmMutator, org.refcodes.web.RealmAccessor.RealmProperty -
Method Summary
Modifier and TypeMethodDescriptionvoidonHttpRequest(InetSocketAddress aLocalAddress, InetSocketAddress aClientAddress, org.refcodes.web.HttpMethod aHttpMethod, org.refcodes.web.Url aUrl, org.refcodes.web.RequestHeaderFields aRequestHeaderFields, InputStream aHttpInputStream, org.refcodes.web.HttpServerResponse aHttpServerResponse) Invoke this method to simulate a REST request to be handled by the according registeredRestEndpointinstances:.voidonHttpRequest(InetSocketAddress aLocalAddress, InetSocketAddress aClientAddress, org.refcodes.web.HttpMethod aHttpMethod, org.refcodes.web.Url aUrl, org.refcodes.web.RequestHeaderFields aRequestHeaderFields, String aHttpBody, org.refcodes.web.HttpServerResponse aHttpServerResponse) Invoke this method to simulate a REST request to be handled by the according registeredRestEndpointinstances:default LoopbackRestServerwithBaseLocator(String aBaseLocator) default LoopbackRestServerwithHttpExceptionHandler(HttpExceptionHandler aHttpErrorHandler) Sets theHttpExceptionHandlerfor theHttpExceptionHandlerproperty.default LoopbackRestServerwithHttpExceptionHandling(HttpExceptionHandling aHttpErrorHandling) Sets theHttpExceptionHandlingfor theHttpExceptionHandlingproperty.default LoopbackRestServerMethods inherited from interface org.refcodes.web.BaseLocatorAccessor
getBaseLocatorMethods inherited from interface org.refcodes.web.BaseLocatorAccessor.BaseLocatorMutator
setBaseLocatorMethods inherited from interface org.refcodes.web.BaseLocatorAccessor.BaseLocatorProperty
letBaseLocatorMethods inherited from interface org.refcodes.rest.HttpExceptionHandlerAccessor
getHttpExceptionHandlerMethods inherited from interface org.refcodes.rest.HttpExceptionHandlerAccessor.HttpExceptionHandlerBuilder
withOnHttpExceptionMethods inherited from interface org.refcodes.rest.HttpExceptionHandlerAccessor.HttpExceptionHandlerMutator
onHttpException, setHttpExceptionHandlerMethods inherited from interface org.refcodes.rest.HttpExceptionHandlerAccessor.HttpExceptionHandlerProperty
letHttpExceptionHandlerMethods inherited from interface org.refcodes.rest.HttpExceptionHandlingAccessor
getHttpExceptionHandlingMethods inherited from interface org.refcodes.rest.HttpExceptionHandlingAccessor.HttpExceptionHandlingMutator
setHttpExceptionHandlingMethods inherited from interface org.refcodes.rest.HttpExceptionHandlingAccessor.HttpExceptionHandlingProperty
letHttpExceptionHandlingMethods inherited from interface org.refcodes.web.MediaTypeFactoryLookup
getFactoryMediaTypes, hasMediaTypeFactory, toMediaTypeFactoryMethods inherited from interface org.refcodes.web.MediaTypeFactoryLookup.MutableMediaTypeFactoryLookup
addMediaTypeFactoryMethods inherited from interface org.refcodes.observer.Observable
hasObserverSubscription, subscribeObserver, unsubscribeObserverMethods inherited from interface org.refcodes.observer.Observers
disableObservers, enableObservers, isObserversActive, observers, setObserversActiveMethods inherited from interface org.refcodes.web.RealmAccessor
getRealmMethods inherited from interface org.refcodes.web.RealmAccessor.RealmMutator
setRealmMethods inherited from interface org.refcodes.web.RealmAccessor.RealmProperty
letRealmMethods inherited from interface org.refcodes.runtime.RequestCorrelation
disableRequestCorrelation, enableRequestCorrelation, hasRequestCorrelation, setRequestCorrelationMethods inherited from interface org.refcodes.rest.RestServer
onDelete, onDelete, onGet, onGet, onPost, onPost, onPut, onPut, onRequest, onRequest, onRequest, onRequest, onRequest, withDisableObservers, withDisableRequestCorrelation, withDisableSessionCorrelation, withEnableObservers, withEnableRequestCorrelation, withEnableSessionCorrelation, withObserversActive, withRequestCorrelation, withSessionCorrelationMethods inherited from interface org.refcodes.runtime.SessionCorrelation
disableSessionCorrelation, enableSessionCorrelation, hasSessionCorrelation, setSessionCorrelation
-
Method Details
-
onHttpRequest
void onHttpRequest(InetSocketAddress aLocalAddress, InetSocketAddress aClientAddress, org.refcodes.web.HttpMethod aHttpMethod, org.refcodes.web.Url aUrl, org.refcodes.web.RequestHeaderFields aRequestHeaderFields, String aHttpBody, org.refcodes.web.HttpServerResponse aHttpServerResponse) throws org.refcodes.web.HttpStatusException Invoke this method to simulate a REST request to be handled by the according registeredRestEndpointinstances:- Parameters:
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- TheHttpServerResponseto be filled with the complete result of processing the request.- Throws:
org.refcodes.web.HttpStatusException- the http status exception
-
onHttpRequest
void onHttpRequest(InetSocketAddress aLocalAddress, InetSocketAddress aClientAddress, org.refcodes.web.HttpMethod aHttpMethod, org.refcodes.web.Url aUrl, org.refcodes.web.RequestHeaderFields aRequestHeaderFields, InputStream aHttpInputStream, org.refcodes.web.HttpServerResponse aHttpServerResponse) throws org.refcodes.web.HttpStatusException Invoke this method to simulate a REST request to be handled by the according registeredRestEndpointinstances:.- Parameters:
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 usedaHttpInputStream- The HTTPInputStreamrepresenting the body for the simulated REST request to be used.aHttpServerResponse- TheHttpServerResponseto be filled with the complete result of processing the request.- Throws:
org.refcodes.web.HttpStatusException- the http status exception
-
withHttpExceptionHandler
Sets theHttpExceptionHandlerfor theHttpExceptionHandlerproperty.- Specified by:
withHttpExceptionHandlerin interfaceHttpExceptionHandlerAccessor.HttpExceptionHandlerBuilder<RestServer>- Parameters:
aHttpErrorHandler- TheHttpExceptionHandlerto be stored by theHttpExceptionHandlerproperty.- Returns:
- The builder for applying multiple build operations.
-
withHttpExceptionHandling
Sets theHttpExceptionHandlingfor theHttpExceptionHandlingproperty.- Specified by:
withHttpExceptionHandlingin interfaceHttpExceptionHandlingAccessor.HttpExceptionHandlingBuilder<RestServer>- Parameters:
aHttpErrorHandling- TheHttpExceptionHandlingto be stored by theHttpExceptionHandlingproperty.- Returns:
- The builder for applying multiple build operations.
-
withRealm
- Specified by:
withRealmin interfaceorg.refcodes.web.RealmAccessor.RealmBuilder<RestServer>- Specified by:
withRealmin interfaceRestServer
-
withBaseLocator
- Specified by:
withBaseLocatorin interfaceorg.refcodes.web.BaseLocatorAccessor.BaseLocatorBuilder<RestServer>- Specified by:
withBaseLocatorin interfaceRestServer
-