Package org.refcodes.rest
Class HttpRestServerSugar
- java.lang.Object
-
- org.refcodes.rest.HttpRestServerSugar
-
public class HttpRestServerSugar extends java.lang.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.net.BasicAuthObserver aObserver)
SeeBasicAuthObservable.onBasicAuthRequest(BasicAuthObserver)
static RestEndpointBuilder
onDelete(java.lang.String aLocatorPattern, RestRequestObserver aRequestObserver)
static RestEndpointBuilder
onGet(java.lang.String aLocatorPattern, RestRequestObserver aRequestObserver)
static RestEndpointBuilder
onPost(java.lang.String aLocatorPattern, RestRequestObserver aRequestObserver)
static RestEndpointBuilder
onPut(java.lang.String aLocatorPattern, RestRequestObserver aRequestObserver)
static RestEndpointBuilder
onRequest(java.lang.String aLocatorPattern, RestRequestObserver aRequestObserver)
static RestEndpointBuilder
onRequest(org.refcodes.net.HttpMethod aHttpMethod, java.lang.String aLocatorPattern, RestRequestObserver aRequestObserver)
static HttpRestServer
open(int aPort)
static HttpRestServer
open(int aPort, int aMaxConnections)
static HttpRestServer
open(java.lang.String aSecureSocketProtocol, org.refcodes.security.KeyStoreDescriptor aStoreDescriptor, java.lang.Integer aPort)
static HttpRestServer
open(java.lang.String aSecureSocketProtocol, org.refcodes.security.KeyStoreDescriptor aStoreDescriptor, java.lang.Integer aPort, int aMaxConnections)
static HttpRestServer
open(org.refcodes.net.HttpServerContext aCtx)
SeeConnectionOpenable.open(Object)
static HttpRestServer
open(org.refcodes.security.KeyStoreDescriptor aStoreDescriptor, java.lang.Integer aPort)
static HttpRestServer
open(org.refcodes.security.KeyStoreDescriptor aStoreDescriptor, java.lang.Integer aPort, int aMaxConnections)
static boolean
unsubscribeObserver(RestEndpoint aEndpoint)
SeeObservable.unsubscribeObserver(Object)
static HttpRestServer
withBaseLocator(java.lang.String aBaseLocator)
static HttpRestServer
withRealm(java.lang.String aRealm)
-
-
-
Method Detail
-
close
public static HttpRestServer close() throws org.refcodes.component.CloseException
SeeClosable.close()
- Returns:
- The
HttpRestServer
- Throws:
org.refcodes.component.CloseException
- 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.net.BasicAuthObserver aObserver)
SeeBasicAuthObservable.onBasicAuthRequest(BasicAuthObserver)
- Parameters:
aObserver
- The observer- Returns:
- The
HttpRestServer
-
onDelete
public static RestEndpointBuilder onDelete(java.lang.String aLocatorPattern, RestRequestObserver aRequestObserver)
- Parameters:
aLocatorPattern
- The locator patternaRequestObserver
- The request observer- Returns:
- The
RestEndpointBuilder
-
onGet
public static RestEndpointBuilder onGet(java.lang.String aLocatorPattern, RestRequestObserver aRequestObserver)
- Parameters:
aLocatorPattern
- The locator patternaRequestObserver
- The request observer- Returns:
- The
RestEndpointBuilder
-
onPost
public static RestEndpointBuilder onPost(java.lang.String aLocatorPattern, RestRequestObserver aRequestObserver)
- Parameters:
aLocatorPattern
- The locator patternaRequestObserver
- The request observer- Returns:
- The
RestEndpointBuilder
SeeRestServer.onPost(String, RestRequestObserver)
-
onPut
public static RestEndpointBuilder onPut(java.lang.String aLocatorPattern, RestRequestObserver aRequestObserver)
- Parameters:
aLocatorPattern
- The locator patternaRequestObserver
- The request observer- Returns:
- The
RestEndpointBuilder
-
onRequest
public static RestEndpointBuilder onRequest(org.refcodes.net.HttpMethod aHttpMethod, java.lang.String aLocatorPattern, RestRequestObserver aRequestObserver)
- Parameters:
aHttpMethod
- The HTTP-MethodaLocatorPattern
- The locator patternaRequestObserver
- The request observer- Returns:
- The
RestEndpointBuilder
-
onRequest
public static RestEndpointBuilder onRequest(java.lang.String aLocatorPattern, RestRequestObserver aRequestObserver)
- Parameters:
aLocatorPattern
- The locator patternaRequestObserver
- The request observer- Returns:
- The
RestEndpointBuilder
-
open
public static HttpRestServer open(org.refcodes.net.HttpServerContext aCtx) throws org.refcodes.component.OpenException
SeeConnectionOpenable.open(Object)
- Parameters:
aCtx
- The context describing the parameters required to open the connection.- Returns:
- The
HttpRestServer
- Throws:
org.refcodes.component.OpenException
- thrown in case the open operation caused problems.
-
open
public static HttpRestServer open(int aPort) throws org.refcodes.component.OpenException
- Parameters:
aPort
- The port- Returns:
- The
HttpRestServer
- Throws:
org.refcodes.component.OpenException
- thrown in case the open operation caused problems.
-
open
public static HttpRestServer open(int aPort, int aMaxConnections) throws org.refcodes.component.OpenException
- Parameters:
aPort
- The portaMaxConnections
- The max connections- Returns:
- The
HttpRestServer
- Throws:
org.refcodes.component.OpenException
- thrown in case the open operation caused problems.
-
open
public static HttpRestServer open(org.refcodes.security.KeyStoreDescriptor aStoreDescriptor, java.lang.Integer aPort) throws org.refcodes.component.OpenException
- Parameters:
aStoreDescriptor
- The store descriptor describing yourKeyStore
required by HTTP.aPort
- The port- Returns:
- The
HttpRestServer
- Throws:
org.refcodes.component.OpenException
- thrown in case the open operation caused problems.
-
open
public static HttpRestServer open(org.refcodes.security.KeyStoreDescriptor aStoreDescriptor, java.lang.Integer aPort, int aMaxConnections) throws org.refcodes.component.OpenException
- Parameters:
aStoreDescriptor
- The store descriptor describing yourKeyStore
required by HTTP.aPort
- The portaMaxConnections
- The max connections- Returns:
- The
HttpRestServer
- Throws:
org.refcodes.component.OpenException
- thrown in case the open operation caused problems.
-
open
public static HttpRestServer open(java.lang.String aSecureSocketProtocol, org.refcodes.security.KeyStoreDescriptor aStoreDescriptor, java.lang.Integer aPort) throws org.refcodes.component.OpenException
- Parameters:
aSecureSocketProtocol
- The secure socket protocolaStoreDescriptor
- The store descriptor describing yourKeyStore
required by HTTP.aPort
- The port- Returns:
- The
HttpRestServer
- Throws:
org.refcodes.component.OpenException
- thrown in case the open operation caused problems.
-
open
public static HttpRestServer open(java.lang.String aSecureSocketProtocol, org.refcodes.security.KeyStoreDescriptor aStoreDescriptor, java.lang.Integer aPort, int aMaxConnections) throws org.refcodes.component.OpenException
- Parameters:
aSecureSocketProtocol
- The secure socket protocolaStoreDescriptor
- The store descriptor describing yourKeyStore
required by HTTP.aPort
- The portaMaxConnections
- The max connections- Returns:
- The
HttpRestServer
- Throws:
org.refcodes.component.OpenException
- 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(java.lang.String aBaseLocator)
- Parameters:
aBaseLocator
- The base locator- Returns:
- The
HttpRestServer
-
withRealm
public static HttpRestServer withRealm(java.lang.String aRealm)
- Parameters:
aRealm
- The realm- Returns:
- The
HttpRestServer
-
-