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 RestfulHttpServer
close()
SeeClosable.close()
.static RestfulHttpServer
closeIn
(int aCloseMillis) SeeClosable.closeIn(int)
.static RestfulHttpServer
SeeClosable.closeQuietly()
.static RestfulHttpServer
SeeRestfulHttpServer
.static RestfulHttpServer
onBasicAuthRequest
(org.refcodes.web.BasicAuthObserver aObserver) SeeBasicAuthObservable.onBasicAuthRequest(BasicAuthObserver)
.static RestEndpointBuilder
onDelete
(String aLocatorPathPattern, RestRequestConsumer aRequestConsumer) static RestEndpointBuilder
onDelete
(Pattern aLocatorRegExp, RestRequestConsumer aRequestConsumer) static RestEndpointBuilder
onGet
(String aLocatorPathPattern, RestRequestConsumer aRequestConsumer) static RestEndpointBuilder
onGet
(Pattern aLocatorRegExp, RestRequestConsumer aRequestConsumer) static RestfulHttpServer
onHttpException
(HttpExceptionHandler aHttpExceptionHandler) static RestEndpointBuilder
onPost
(String aLocatorPathPattern, RestRequestConsumer aRequestConsumer) static RestEndpointBuilder
onPost
(Pattern aLocatorRegExp, RestRequestConsumer aRequestConsumer) static RestEndpointBuilder
onPut
(String aLocatorPathPattern, RestRequestConsumer aRequestConsumer) static RestEndpointBuilder
onPut
(Pattern aLocatorRegExp, RestRequestConsumer aRequestConsumer) static RestEndpointBuilder
onRequest
(String aLocatorPathPattern, RestRequestConsumer aRequestConsumer) static RestEndpointBuilder
onRequest
(Pattern aLocatorRegExp, RestRequestConsumer aRequestConsumer) static RestEndpointBuilder
onRequest
(org.refcodes.web.HttpMethod aHttpMethod, String aLocatorPathPattern, RestRequestConsumer aRequestConsumer) static RestEndpointBuilder
onRequest
(org.refcodes.web.HttpMethod aHttpMethod, Pattern aLocatorRegExp, RestRequestConsumer aRequestConsumer) static RestfulHttpServer
open
(int aPort) static RestfulHttpServer
open
(int aPort, int aMaxConnections) static RestfulHttpServer
open
(String aSecureSocketProtocol, org.refcodes.security.KeyStoreDescriptor aStoreDescriptor, Integer aPort) static RestfulHttpServer
open
(String aSecureSocketProtocol, org.refcodes.security.KeyStoreDescriptor aStoreDescriptor, Integer aPort, int aMaxConnections) static RestfulHttpServer
static RestfulHttpServer
static RestfulHttpServer
open
(org.refcodes.web.HttpServerContext aCtx) SeeConnectionOpenable.open(Object)
.static boolean
unsubscribeObserver
(RestEndpoint aEndpoint) SeeObservable.unsubscribeObserver(Object)
.static RestfulHttpServer
withBaseLocator
(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
RestEndpointBuilder
SeeRestfulServer.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
RestEndpointBuilder
SeeRestfulServer.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 yourKeyStore
required 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 yourKeyStore
required 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 yourKeyStore
required 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 yourKeyStore
required 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
-