Interface HttpRestServer

All Superinterfaces:
org.refcodes.web.BaseLocatorAccessor, org.refcodes.web.BaseLocatorAccessor.BaseLocatorBuilder<RestServer>, org.refcodes.web.BaseLocatorAccessor.BaseLocatorMutator, org.refcodes.web.BaseLocatorAccessor.BaseLocatorProperty, org.refcodes.web.BasicAuthObservable<HttpRestServer>, org.refcodes.component.Closable, org.refcodes.component.Closable.CloseBuilder<org.refcodes.component.ConnectionComponent.ConnectionComponentBuilder<org.refcodes.web.HttpServerContext,HttpRestServer>>, org.refcodes.component.ConnectionComponent<org.refcodes.web.HttpServerContext>, org.refcodes.component.ConnectionComponent.ConnectionComponentBuilder<org.refcodes.web.HttpServerContext,HttpRestServer>, org.refcodes.component.ConnectionOpenable<org.refcodes.web.HttpServerContext>, org.refcodes.component.ConnectionOpenable.ConnectionOpenBuilder<org.refcodes.web.HttpServerContext,org.refcodes.component.ConnectionComponent.ConnectionComponentBuilder<org.refcodes.web.HttpServerContext,HttpRestServer>>, org.refcodes.component.ConnectionStatusAccessor, HttpExceptionHandlerAccessor, HttpExceptionHandlerAccessor.HttpExceptionHandlerBuilder<HttpRestServer>, HttpExceptionHandlerAccessor.HttpExceptionHandlerMutator, HttpExceptionHandlerAccessor.HttpExceptionHandlerProperty, HttpExceptionHandlingAccessor, HttpExceptionHandlingAccessor.HttpExceptionHandlingBuilder<HttpRestServer>, HttpExceptionHandlingAccessor.HttpExceptionHandlingMutator, HttpExceptionHandlingAccessor.HttpExceptionHandlingProperty, org.refcodes.web.HttpsConnectionRequestObservable<HttpRestServer>, org.refcodes.web.HttpServerInterceptable, KeyStoreDescriptorAccessor, KeyStoreDescriptorAccessor.KeyStoreDescriptorBuilder<HttpRestServer>, KeyStoreDescriptorAccessor.KeyStoreDescriptorMutator, KeyStoreDescriptorAccessor.KeyStoreDescriptorProperty, org.refcodes.component.LinkComponent, org.refcodes.io.MaxConnectionsAccessor, org.refcodes.io.MaxConnectionsAccessor.MaxConnectionsBuilder<HttpRestServer>, org.refcodes.io.MaxConnectionsAccessor.MaxConnectionsMutator, org.refcodes.io.MaxConnectionsAccessor.MaxConnectionsProperty, org.refcodes.web.MediaTypeFactoryLookup, org.refcodes.web.MediaTypeFactoryLookup.MutableMediaTypeFactoryLookup, org.refcodes.observer.Observable<RestEndpoint>, org.refcodes.observer.Observers<RestEndpoint,RestServer>, org.refcodes.component.Openable, org.refcodes.component.OpenedAccessor, org.refcodes.mixin.PortAccessor, org.refcodes.mixin.PortAccessor.PortBuilder<HttpRestServer>, org.refcodes.mixin.PortAccessor.PortMutator, org.refcodes.mixin.PortAccessor.PortProperty, org.refcodes.web.PostHttpInterceptable<org.refcodes.web.PostHttpServerInterceptor>, org.refcodes.web.PostHttpServerInterceptable, org.refcodes.web.PreHttpInterceptable<org.refcodes.web.PreHttpServerInterceptor>, org.refcodes.web.PreHttpServerInterceptable, org.refcodes.web.RealmAccessor, org.refcodes.web.RealmAccessor.RealmBuilder<RestServer>, org.refcodes.web.RealmAccessor.RealmMutator, org.refcodes.web.RealmAccessor.RealmProperty, RestServer, org.refcodes.web.SchemeAccessor, org.refcodes.web.SchemeAccessor.SchemeBuilder<HttpRestServer>, org.refcodes.web.SchemeAccessor.SchemeMutator, org.refcodes.web.SchemeAccessor.SchemeProperty
All Known Subinterfaces:
HttpRestRegistryServer<DESC,B>
All Known Implementing Classes:
AbstractHttpRestRegistryServerDecorator, AbstractHttpRestServerDecorator, JdkHttpRestServer, JdkHttpRestServerSingleton

public interface HttpRestServer extends RestServer, org.refcodes.web.HttpServerInterceptable, HttpExceptionHandlerAccessor.HttpExceptionHandlerProperty, HttpExceptionHandlerAccessor.HttpExceptionHandlerBuilder<HttpRestServer>, HttpExceptionHandlingAccessor.HttpExceptionHandlingProperty, HttpExceptionHandlingAccessor.HttpExceptionHandlingBuilder<HttpRestServer>, org.refcodes.component.LinkComponent, org.refcodes.component.ConnectionStatusAccessor, org.refcodes.component.ConnectionComponent.ConnectionComponentBuilder<org.refcodes.web.HttpServerContext,HttpRestServer>, org.refcodes.web.BasicAuthObservable<HttpRestServer>, org.refcodes.web.HttpsConnectionRequestObservable<HttpRestServer>, org.refcodes.mixin.PortAccessor.PortProperty, org.refcodes.mixin.PortAccessor.PortBuilder<HttpRestServer>, org.refcodes.web.SchemeAccessor.SchemeProperty, org.refcodes.web.SchemeAccessor.SchemeBuilder<HttpRestServer>, KeyStoreDescriptorAccessor.KeyStoreDescriptorProperty, KeyStoreDescriptorAccessor.KeyStoreDescriptorBuilder<HttpRestServer>, org.refcodes.io.MaxConnectionsAccessor.MaxConnectionsProperty, org.refcodes.io.MaxConnectionsAccessor.MaxConnectionsBuilder<HttpRestServer>
Extends a RestServer to be capable of opening a server socket on the local host with the provided port number via ConnectionOpenable.open(Object) or with an additional maximum number of connections via open(int, int). To open a HTTPS port, use the methods such as: open(KeyStoreDescriptor, int) or open(KeyStoreDescriptor, int, int) or open(String, KeyStoreDescriptor, int) or open(String, KeyStoreDescriptor, int, int). A HttpRestServer can be shutdown via Closable.close().
  • Method Details

    • withHttpExceptionHandler

      default HttpRestServer withHttpExceptionHandler(HttpExceptionHandler aHttpErrorHandler)
      Sets the HttpExceptionHandler for the HttpExceptionHandler property.
      Specified by:
      withHttpExceptionHandler in interface HttpExceptionHandlerAccessor.HttpExceptionHandlerBuilder<HttpRestServer>
      Parameters:
      aHttpErrorHandler - The HttpExceptionHandler to be stored by the HttpExceptionHandler property.
      Returns:
      The builder for applying multiple build operations.
    • withHttpExceptionHandling

      default HttpRestServer withHttpExceptionHandling(HttpExceptionHandling aHttpErrorHandling)
      Sets the HttpExceptionHandling for the HttpExceptionHandling property.
      Specified by:
      withHttpExceptionHandling in interface HttpExceptionHandlingAccessor.HttpExceptionHandlingBuilder<HttpRestServer>
      Parameters:
      aHttpErrorHandling - The HttpExceptionHandling to be stored by the HttpExceptionHandling property.
      Returns:
      The builder for applying multiple build operations.
    • withRealm

      default HttpRestServer withRealm(String aRealm)
      Specified by:
      withRealm in interface org.refcodes.web.RealmAccessor.RealmBuilder<RestServer>
      Specified by:
      withRealm in interface RestServer
    • withBaseLocator

      default HttpRestServer withBaseLocator(String aBaseLocator)
      Specified by:
      withBaseLocator in interface org.refcodes.web.BaseLocatorAccessor.BaseLocatorBuilder<RestServer>
      Specified by:
      withBaseLocator in interface RestServer
    • withClose

      default HttpRestServer withClose() throws IOException
      Specified by:
      withClose in interface org.refcodes.component.Closable.CloseBuilder<org.refcodes.component.ConnectionComponent.ConnectionComponentBuilder<org.refcodes.web.HttpServerContext,HttpRestServer>>
      Throws:
      IOException
    • withCloseQuietly

      default HttpRestServer withCloseQuietly()
      Specified by:
      withCloseQuietly in interface org.refcodes.component.Closable.CloseBuilder<org.refcodes.component.ConnectionComponent.ConnectionComponentBuilder<org.refcodes.web.HttpServerContext,HttpRestServer>>
    • withCloseIn

      default HttpRestServer withCloseIn(int aCloseMillis)
      Specified by:
      withCloseIn in interface org.refcodes.component.Closable.CloseBuilder<org.refcodes.component.ConnectionComponent.ConnectionComponentBuilder<org.refcodes.web.HttpServerContext,HttpRestServer>>
    • withOpen

      default HttpRestServer withOpen(org.refcodes.web.HttpServerContext aConnection) throws IOException
      Specified by:
      withOpen in interface org.refcodes.component.ConnectionOpenable.ConnectionOpenBuilder<org.refcodes.web.HttpServerContext,org.refcodes.component.ConnectionComponent.ConnectionComponentBuilder<org.refcodes.web.HttpServerContext,HttpRestServer>>
      Throws:
      IOException
    • withOpen

      default HttpRestServer withOpen(int aPort) throws IOException
      Builder method for opening the HttpRestServer. Delegates to open(int) and returns this method.
      Parameters:
      aPort - The port on which to listen for requests.
      Returns:
      This instance for applying method chaining.
      Throws:
      IOException - thrown in case something went wrong such as the port being already in use.
    • withPort

      default HttpRestServer withPort(int aPort)
      Specified by:
      withPort in interface org.refcodes.mixin.PortAccessor.PortBuilder<HttpRestServer>
    • withScheme

      default HttpRestServer withScheme(org.refcodes.data.Scheme aScheme)
      Specified by:
      withScheme in interface org.refcodes.web.SchemeAccessor.SchemeBuilder<HttpRestServer>
    • withProtocol

      default HttpRestServer withProtocol(String aProtocol)
      Specified by:
      withProtocol in interface org.refcodes.web.SchemeAccessor.SchemeBuilder<HttpRestServer>
    • withKeyStoreDescriptor

      default HttpRestServer withKeyStoreDescriptor(KeyStoreDescriptor aKeyStoreDescriptor)
      Specified by:
      withKeyStoreDescriptor in interface KeyStoreDescriptorAccessor.KeyStoreDescriptorBuilder<HttpRestServer>
    • withMaxConnections

      default HttpRestServer withMaxConnections(int aMaxConnections)
      Specified by:
      withMaxConnections in interface org.refcodes.io.MaxConnectionsAccessor.MaxConnectionsBuilder<HttpRestServer>
    • open

      default void open() throws IOException
      Specified by:
      open in interface org.refcodes.component.Openable
      Throws:
      IOException
    • open

      default void open(int aPort) throws IOException
      Opens the HTTP sever connection (socket) at the given port.
      Parameters:
      aPort - The port on which to listen for requests.
      Throws:
      IOException - thrown in case something went wrong such as the port being already in use.
    • open

      default void open(int aPort, int aMaxConnections) throws IOException
      Opens the HTTP sever connection (socket) at the given port allowing the given number of maximum connections at the same time.
      Parameters:
      aPort - The port on which to listen for requests.
      aMaxConnections - The number of maximum connections at the same time.
      Throws:
      IOException - thrown in case something went wrong such as the port being already in use.
    • open

      default void open(String aProtocol, KeyStoreDescriptor aStoreDescriptor, int aPort) throws IOException
      Same as open(String, KeyStoreDescriptor, int, int) but:
      • The number of maximum connections at the same time is decided upon by the implementations's default value.
      Parameters:
      aProtocol - The protocol to use, e.g. "TLS".
      aStoreDescriptor - The store descriptor describing your KeyStore required for HTTPS.
      aPort - The port on which to listen for requests.
      Throws:
      IOException - thrown in case something went wrong such as the port being already in use.
    • open

      default void open(String aProtocol, KeyStoreDescriptor aStoreDescriptor) throws IOException
      Same as open(String, KeyStoreDescriptor, int) but:
      • The number of maximum connections at the same time is decided upon by the implementations's default value.
      Parameters:
      aProtocol - The protocol to use, e.g. "TLS".
      aStoreDescriptor - The store descriptor describing your KeyStore required for HTTPS.
      Throws:
      IOException - thrown in case something went wrong such as the port being already in use.
    • open

      default void open(KeyStoreDescriptor aStoreDescriptor, int aPort, int aMaxConnections) throws IOException
      Same as open(String, KeyStoreDescriptor, int, int) but:
      • The protocol for the underlying SSLContext used is set to "TLS".
      • The type of KeyStore is set to "JKS".
      • The password for the KeyStore's key is assumed to be the same as the provided KeyStore password.
      Parameters:
      aStoreDescriptor - The store descriptor describing your KeyStore required for HTTPS.
      aPort - The port on which to listen for requests.
      aMaxConnections - The number of maximum connections at the same time.
      Throws:
      IOException - thrown in case something went wrong such as the port being already in use.
    • open

      default void open(KeyStoreDescriptor aStoreDescriptor, int aPort) throws IOException
      Same as open(String, KeyStoreDescriptor, int, int) but:
      • The protocol for the underlying SSLContext used is set to "TLS".
      • The type of KeyStore is set to "JKS".
      Parameters:
      aStoreDescriptor - The store descriptor describing your KeyStore required for HTTPS.
      aPort - The port on which to listen for requests.
      Throws:
      IOException - thrown in case something went wrong such as the port being already in use.
    • open

      default void open(KeyStoreDescriptor aStoreDescriptor) throws IOException
      Same as open(String, KeyStoreDescriptor, int) but:
      • The protocol for the underlying SSLContext used is set to "TLS".
      • The type of KeyStore is set to "JKS".
      Parameters:
      aStoreDescriptor - The store descriptor describing your KeyStore required for HTTPS.
      Throws:
      IOException - thrown in case something went wrong such as the port being already in use.
    • open

      default void open(org.refcodes.data.Scheme aScheme, KeyStoreDescriptor aStoreDescriptor, int aPort, int aMaxConnections) throws IOException
      Opens the HTTPS sever connection (socket) at the given port allowing the given number of maximum connections at the same time using the provided HTTPS configuration parameters.
      Parameters:
      aScheme - The Scheme to use, e.g. Scheme.HTTPS defaults to "TLS".
      aStoreDescriptor - The store descriptor describing your KeyStore required for HTTPS.
      aPort - The port on which to listen for requests.
      aMaxConnections - The number of maximum connections at the same time.
      Throws:
      IOException - thrown in case something went wrong such as the port being already in use.
    • open

      default void open(org.refcodes.data.Scheme aScheme, KeyStoreDescriptor aStoreDescriptor, int aPort) throws IOException
      Same as open(String, KeyStoreDescriptor, int, int) but:
      • The number of maximum connections at the same time is decided upon by the implementations's default value.
      Parameters:
      aScheme - The Scheme to use, e.g. Scheme.HTTPS defaults to "TLS".
      aStoreDescriptor - The store descriptor describing your KeyStore required for HTTPS.
      aPort - The port on which to listen for requests.
      Throws:
      IOException - thrown in case something went wrong such as the port being already in use.
    • open

      default void open(org.refcodes.data.Scheme aScheme, KeyStoreDescriptor aStoreDescriptor) throws IOException
      Same as open(String, KeyStoreDescriptor, int) but:
      • The number of maximum connections at the same time is decided upon by the implementations's default value.
      Parameters:
      aScheme - The Scheme to use, e.g. Scheme.HTTPS defaults to "TLS".
      aStoreDescriptor - The store descriptor describing your KeyStore required for HTTPS.
      Throws:
      IOException - thrown in case something went wrong such as the port being already in use.
    • open

      void open(String aProtocol, KeyStoreDescriptor aStoreDescriptor, int aPort, int aMaxConnections) throws IOException
      Opens the HTTPS sever connection (socket) at the given port allowing the given number of maximum connections at the same time using the provided HTTPS configuration parameters.
      Parameters:
      aProtocol - The protocol to use, e.g. "TLS".
      aStoreDescriptor - The store descriptor describing your KeyStore required for HTTPS.
      aPort - The port on which to listen for requests.
      aMaxConnections - The number of maximum connections at the same time.
      Throws:
      IOException - thrown in case something went wrong such as the port being already in use.
    • open

      default void open(org.refcodes.web.HttpServerContext aConnection) throws IOException
      Specified by:
      open in interface org.refcodes.component.ConnectionOpenable<org.refcodes.web.HttpServerContext>
      Throws:
      IOException