- java.lang.Object
-
- org.refcodes.rest.HttpRestServerSugar
-
public class HttpRestServerSugar extends Object
Declarative syntactic sugar which may be statically imported in order to allow declarative definitions of RESTful server functionality:import static org.refcodes.rest.HttpRestServerSugar.*;
-
-
Constructor Summary
Constructors Constructor Description HttpRestServerSugar()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static HttpRestServer
close()
SeeClosable.close()
static HttpRestServer
closeIn(int aCloseInMillis)
SeeClosable.closeIn(int)
static HttpRestServer
closeQuietly()
SeeClosable.closeQuietly()
static HttpRestServer
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 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 HttpRestServer
open(int aPort)
static HttpRestServer
open(int aPort, int aMaxConnections)
static HttpRestServer
open(String aSecureSocketProtocol, org.refcodes.security.KeyStoreDescriptor aStoreDescriptor, Integer aPort)
static HttpRestServer
open(String aSecureSocketProtocol, org.refcodes.security.KeyStoreDescriptor aStoreDescriptor, Integer aPort, int aMaxConnections)
static HttpRestServer
open(org.refcodes.security.KeyStoreDescriptor aStoreDescriptor, Integer aPort)
static HttpRestServer
open(org.refcodes.security.KeyStoreDescriptor aStoreDescriptor, Integer aPort, int aMaxConnections)
static HttpRestServer
open(org.refcodes.web.HttpServerContext aCtx)
SeeConnectionOpenable.open(Object)
static boolean
unsubscribeObserver(RestEndpoint aEndpoint)
SeeObservable.unsubscribeObserver(Object)
static HttpRestServer
withBaseLocator(String aBaseLocator)
static HttpRestServer
withRealm(String aRealm)
-
-
-
Method Detail
-
close
public static HttpRestServer close() throws IOException
SeeClosable.close()
- Returns:
- The
HttpRestServer
- Throws:
IOException
- the close exception
-
closeIn
public static HttpRestServer closeIn(int aCloseInMillis)
SeeClosable.closeIn(int)
- Parameters:
aCloseInMillis
- The close in millis- Returns:
- The
HttpRestServer
-
closeQuietly
public static HttpRestServer closeQuietly()
SeeClosable.closeQuietly()
- Returns:
- The
HttpRestServer
-
onBasicAuthRequest
public static HttpRestServer onBasicAuthRequest(org.refcodes.web.BasicAuthObserver aObserver)
SeeBasicAuthObservable.onBasicAuthRequest(BasicAuthObserver)
- Parameters:
aObserver
- The observer- Returns:
- The
HttpRestServer
-
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
SeeRestServer.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
SeeRestServer.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
public static HttpRestServer open(org.refcodes.web.HttpServerContext aCtx) throws IOException
SeeConnectionOpenable.open(Object)
- Parameters:
aCtx
- The context describing the parameters required to open the connection.- Returns:
- The
HttpRestServer
- Throws:
IOException
- thrown in case the open operation caused problems.
-
open
public static HttpRestServer open(int aPort) throws IOException
- Parameters:
aPort
- The port- Returns:
- The
HttpRestServer
- Throws:
IOException
- thrown in case the open operation caused problems.
-
open
public static HttpRestServer open(int aPort, int aMaxConnections) throws IOException
- Parameters:
aPort
- The portaMaxConnections
- The max connections- Returns:
- The
HttpRestServer
- Throws:
IOException
- thrown in case the open operation caused problems.
-
open
public static HttpRestServer 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
HttpRestServer
- Throws:
IOException
- thrown in case the open operation caused problems.
-
open
public static HttpRestServer 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
HttpRestServer
- Throws:
IOException
- thrown in case the open operation caused problems.
-
open
public static HttpRestServer 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
HttpRestServer
- Throws:
IOException
- thrown in case the open operation caused problems.
-
open
public static HttpRestServer 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
HttpRestServer
- Throws:
IOException
- thrown in case the open operation caused problems.
-
unsubscribeObserver
public static boolean unsubscribeObserver(RestEndpoint aEndpoint)
SeeObservable.unsubscribeObserver(Object)
- Parameters:
aEndpoint
- The endpoint- Returns:
- true, if successful
-
withBaseLocator
public static HttpRestServer withBaseLocator(String aBaseLocator)
- Parameters:
aBaseLocator
- The base locator- Returns:
- The
HttpRestServer
-
withRealm
public static HttpRestServer withRealm(String aRealm)
- Parameters:
aRealm
- The realm- Returns:
- The
HttpRestServer
-
-