Class DataStoreHttpServer

java.lang.Object
org.moeaframework.analysis.store.http.DataStoreHttpServer

public class DataStoreHttpServer extends Object
Provides read-only HTTP access to data stores.

This server uses unsecured HTTP connections. Use caution when running on a publicly-accessible network. This is primarily intended for testing and debugging purposes.

  • Constructor Details

    • DataStoreHttpServer

      public DataStoreHttpServer() throws IOException
      Creates a new HTTP server to provide read-only access data stores.
      Throws:
      IOException - if an error occurred starting the server, such as BindException
    • DataStoreHttpServer

      public DataStoreHttpServer(InetSocketAddress address) throws IOException
      Creates a new HTTP server to provide read-only access data stores.
      Parameters:
      address - the socket address the server binds to
      Throws:
      IOException - if an error occurred starting the server, such as BindException
  • Method Details

    • configure

      public void configure(String path, DataStore dataStore)
      Associates the given URI path with the data store.
      Parameters:
      path - the URI path that directs requests to this data store
      dataStore - the data store
    • registerShutdownHook

      public void registerShutdownHook()
      Registers a shutdown hook to stop this server when the JVM shuts down.
    • shutdown

      public void shutdown()
      Shuts down this HTTP server. This should either be called explicitly when the server is not longer in use, or by registerShutdownHook().