java.lang.Object
org.refcodes.rest.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.*;-
Method Summary
Modifier and TypeMethodDescriptionstatic RestfulHttpServerclose()SeeClosable.close().static RestfulHttpServercloseIn(int aCloseMillis) SeeClosable.closeIn(int).static RestfulHttpServerSeeClosable.closeQuietly().static RestfulHttpServerSeeRestfulHttpServer.static RestfulHttpServeronBasicAuthRequest(org.refcodes.web.BasicAuthObserver aObserver) SeeBasicAuthObservable.onBasicAuthRequest(BasicAuthObserver).static RestEndpointBuilderonDelete(String aLocatorPathPattern, RestRequestConsumer aRequestConsumer) static RestEndpointBuilderonDelete(Pattern aLocatorRegExp, RestRequestConsumer aRequestConsumer) static RestEndpointBuilderonGet(String aLocatorPathPattern, RestRequestConsumer aRequestConsumer) static RestEndpointBuilderonGet(Pattern aLocatorRegExp, RestRequestConsumer aRequestConsumer) static RestfulHttpServeronHttpException(HttpExceptionHandler aHttpExceptionHandler) static RestEndpointBuilderonPost(String aLocatorPathPattern, RestRequestConsumer aRequestConsumer) static RestEndpointBuilderonPost(Pattern aLocatorRegExp, RestRequestConsumer aRequestConsumer) static RestEndpointBuilderonPut(String aLocatorPathPattern, RestRequestConsumer aRequestConsumer) static RestEndpointBuilderonPut(Pattern aLocatorRegExp, RestRequestConsumer aRequestConsumer) static RestEndpointBuilderonRequest(String aLocatorPathPattern, RestRequestConsumer aRequestConsumer) static RestEndpointBuilderonRequest(Pattern aLocatorRegExp, RestRequestConsumer aRequestConsumer) static RestEndpointBuilderonRequest(org.refcodes.web.HttpMethod aHttpMethod, String aLocatorPathPattern, RestRequestConsumer aRequestConsumer) static RestEndpointBuilderonRequest(org.refcodes.web.HttpMethod aHttpMethod, Pattern aLocatorRegExp, RestRequestConsumer aRequestConsumer) static RestfulHttpServeropen(int aPort) static RestfulHttpServeropen(int aPort, int aMaxConnections) static RestfulHttpServeropen(String aSecureSocketProtocol, org.refcodes.security.KeyStoreDescriptor aStoreDescriptor, Integer aPort) static RestfulHttpServeropen(String aSecureSocketProtocol, org.refcodes.security.KeyStoreDescriptor aStoreDescriptor, Integer aPort, int aMaxConnections) static RestfulHttpServerstatic RestfulHttpServerstatic RestfulHttpServeropen(org.refcodes.web.HttpServerContext aCtx) SeeConnectionOpenable.open(Object).static booleanunsubscribeObserver(RestEndpoint aEndpoint) SeeObservable.unsubscribeObserver(Object).static RestfulHttpServerwithBaseLocator(String aBaseLocator) static RestfulHttpServer
-
Method Details
-
getHttpRestServer
SeeRestfulHttpServer.- Returns:
- The
RestfulHttpServer
-
close
SeeClosable.close().- Returns:
- The
RestfulHttpServer - Throws:
IOException- the close exception
-
closeIn
SeeClosable.closeIn(int).- Parameters:
aCloseMillis- The close in millis- Returns:
- The
RestfulHttpServer
-
closeQuietly
SeeClosable.closeQuietly().- Returns:
- The
RestfulHttpServer
-
onHttpException
- Parameters:
aHttpExceptionHandler- the http exception handler- Returns:
- The
RestfulHttpServer
-
onBasicAuthRequest
SeeBasicAuthObservable.onBasicAuthRequest(BasicAuthObserver).- Parameters:
aObserver- The observer- Returns:
- The
RestfulHttpServer
-
onDelete
public static RestEndpointBuilder onDelete(String aLocatorPathPattern, RestRequestConsumer aRequestConsumer) - Parameters:
aLocatorPathPattern- The locator patternaRequestConsumer- The request observer- Returns:
- The
RestEndpointBuilder
-
onGet
public static RestEndpointBuilder onGet(String aLocatorPathPattern, RestRequestConsumer aRequestConsumer) - Parameters:
aLocatorPathPattern- The locator patternaRequestConsumer- The request observer- Returns:
- The
RestEndpointBuilder
-
onPost
public static RestEndpointBuilder onPost(String aLocatorPathPattern, RestRequestConsumer aRequestConsumer) - Parameters:
aLocatorPathPattern- The locator patternaRequestConsumer- The request observer- Returns:
- The
RestEndpointBuilderSeeRestfulServer.onPost(String, RestRequestConsumer)
-
onPut
public static RestEndpointBuilder onPut(String aLocatorPathPattern, RestRequestConsumer aRequestConsumer) - Parameters:
aLocatorPathPattern- The locator patternaRequestConsumer- The request observer- Returns:
- The
RestEndpointBuilder
-
onRequest
public static RestEndpointBuilder onRequest(org.refcodes.web.HttpMethod aHttpMethod, String aLocatorPathPattern, RestRequestConsumer aRequestConsumer) - Parameters:
aHttpMethod- The HTTP-MethodaLocatorPathPattern- The locator patternaRequestConsumer- The request observer- Returns:
- The
RestEndpointBuilder
-
onRequest
public static RestEndpointBuilder onRequest(String aLocatorPathPattern, RestRequestConsumer aRequestConsumer) - Parameters:
aLocatorPathPattern- The locator patternaRequestConsumer- The request observer- Returns:
- The
RestEndpointBuilder
-
onDelete
public static RestEndpointBuilder onDelete(Pattern aLocatorRegExp, RestRequestConsumer aRequestConsumer) - Parameters:
aLocatorRegExp- The locator patternaRequestConsumer- The request observer- Returns:
- The
RestEndpointBuilder
-
onGet
public static RestEndpointBuilder onGet(Pattern aLocatorRegExp, RestRequestConsumer aRequestConsumer) - Parameters:
aLocatorRegExp- The locator patternaRequestConsumer- The request observer- Returns:
- The
RestEndpointBuilder
-
onPost
public static RestEndpointBuilder onPost(Pattern aLocatorRegExp, RestRequestConsumer aRequestConsumer) - Parameters:
aLocatorRegExp- The locator patternaRequestConsumer- The request observer- Returns:
- The
RestEndpointBuilderSeeRestfulServer.onPost(String, RestRequestConsumer)
-
onPut
public static RestEndpointBuilder onPut(Pattern aLocatorRegExp, RestRequestConsumer aRequestConsumer) - Parameters:
aLocatorRegExp- The locator patternaRequestConsumer- The request observer- Returns:
- The
RestEndpointBuilder
-
onRequest
public static RestEndpointBuilder onRequest(org.refcodes.web.HttpMethod aHttpMethod, Pattern aLocatorRegExp, RestRequestConsumer aRequestConsumer) - Parameters:
aHttpMethod- The HTTP-MethodaLocatorRegExp- The locator patternaRequestConsumer- The request observer- Returns:
- The
RestEndpointBuilder
-
onRequest
public static RestEndpointBuilder onRequest(Pattern aLocatorRegExp, RestRequestConsumer aRequestConsumer) - Parameters:
aLocatorRegExp- The locator patternaRequestConsumer- The request observer- Returns:
- The
RestEndpointBuilder
-
open
SeeConnectionOpenable.open(Object).- Parameters:
aCtx- The context describing the parameters required to open the connection.- Returns:
- The
RestfulHttpServer - Throws:
IOException- thrown in case the open operation caused problems.
-
open
- Parameters:
aPort- The port- Returns:
- The
RestfulHttpServer - Throws:
IOException- thrown in case the open operation caused problems.
-
open
- Parameters:
aPort- The portaMaxConnections- The max connections- Returns:
- The
RestfulHttpServer - Throws:
IOException- thrown in case the open operation caused problems.
-
open
public static RestfulHttpServer open(org.refcodes.security.KeyStoreDescriptor aStoreDescriptor, Integer aPort) throws IOException - Parameters:
aStoreDescriptor- The store descriptor describing yourKeyStorerequired by HTTP.aPort- The port- Returns:
- The
RestfulHttpServer - Throws:
IOException- thrown in case the open operation caused problems.
-
open
public static RestfulHttpServer open(org.refcodes.security.KeyStoreDescriptor aStoreDescriptor, Integer aPort, int aMaxConnections) throws IOException - Parameters:
aStoreDescriptor- The store descriptor describing yourKeyStorerequired by HTTP.aPort- The portaMaxConnections- The max connections- Returns:
- The
RestfulHttpServer - Throws:
IOException- thrown in case the open operation caused problems.
-
open
public static RestfulHttpServer open(String aSecureSocketProtocol, org.refcodes.security.KeyStoreDescriptor aStoreDescriptor, Integer aPort) throws IOException - Parameters:
aSecureSocketProtocol- The secure socket protocolaStoreDescriptor- The store descriptor describing yourKeyStorerequired by HTTP.aPort- The port- Returns:
- The
RestfulHttpServer - Throws:
IOException- thrown in case the open operation caused problems.
-
open
public static RestfulHttpServer open(String aSecureSocketProtocol, org.refcodes.security.KeyStoreDescriptor aStoreDescriptor, Integer aPort, int aMaxConnections) throws IOException - Parameters:
aSecureSocketProtocol- The secure socket protocolaStoreDescriptor- The store descriptor describing yourKeyStorerequired by HTTP.aPort- The portaMaxConnections- The max connections- Returns:
- The
RestfulHttpServer - Throws:
IOException- thrown in case the open operation caused problems.
-
unsubscribeObserver
SeeObservable.unsubscribeObserver(Object).- Parameters:
aEndpoint- The endpoint- Returns:
- true, if successful
-
withBaseLocator
- Parameters:
aBaseLocator- The base locator- Returns:
- The
RestfulHttpServer
-
withRealm
- Parameters:
aRealm- The realm- Returns:
- The
RestfulHttpServer
-