Package org.refcodes.rest
Class HttpRestServerSugar
- java.lang.Object
-
- org.refcodes.rest.HttpRestServerSugar
-
public class HttpRestServerSugar extends java.lang.ObjectDeclarative 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 HttpRestServerclose()SeeClosable.close()static HttpRestServercloseIn(int aCloseInMillis)SeeClosable.closeIn(int)static HttpRestServercloseQuietly()SeeClosable.closeQuietly()static HttpRestServeronBasicAuthRequest(org.refcodes.net.BasicAuthObserver aObserver)SeeBasicAuthObservable.onBasicAuthRequest(BasicAuthObserver)static RestEndpointBuilderonDelete(java.lang.String aLocatorPattern, RestRequestObserver aRequestObserver)static RestEndpointBuilderonGet(java.lang.String aLocatorPattern, RestRequestObserver aRequestObserver)static RestEndpointBuilderonPost(java.lang.String aLocatorPattern, RestRequestObserver aRequestObserver)static RestEndpointBuilderonPut(java.lang.String aLocatorPattern, RestRequestObserver aRequestObserver)static RestEndpointBuilderonRequest(java.lang.String aLocatorPattern, RestRequestObserver aRequestObserver)static RestEndpointBuilderonRequest(org.refcodes.net.HttpMethod aHttpMethod, java.lang.String aLocatorPattern, RestRequestObserver aRequestObserver)static HttpRestServeropen(int aPort)static HttpRestServeropen(int aPort, int aMaxConnections)static HttpRestServeropen(java.lang.String aSecureSocketProtocol, org.refcodes.security.KeyStoreDescriptor aStoreDescriptor, java.lang.Integer aPort)static HttpRestServeropen(java.lang.String aSecureSocketProtocol, org.refcodes.security.KeyStoreDescriptor aStoreDescriptor, java.lang.Integer aPort, int aMaxConnections)static HttpRestServeropen(org.refcodes.net.HttpServerContext aCtx)SeeConnectionOpenable.open(Object)static HttpRestServeropen(org.refcodes.security.KeyStoreDescriptor aStoreDescriptor, java.lang.Integer aPort)static HttpRestServeropen(org.refcodes.security.KeyStoreDescriptor aStoreDescriptor, java.lang.Integer aPort, int aMaxConnections)static booleanunsubscribeObserver(RestEndpoint aEndpoint)SeeObservable.unsubscribeObserver(Object)static HttpRestServerwithBaseLocator(java.lang.String aBaseLocator)static HttpRestServerwithRealm(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
RestEndpointBuilderSeeRestServer.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 yourKeyStorerequired 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 yourKeyStorerequired 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 yourKeyStorerequired 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 yourKeyStorerequired 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
-
-