java.lang.Object
one.jpro.platform.auth.core.http.HttpOptions
All Implemented Interfaces:
Options

public class HttpOptions extends Object implements Options
Represents configuration options for HttpServer configuration. Usage example:

 HttpOptions options = new HttpOptions()
                         .setHost("127.0.0.1")
                         .setPort(8080)
                         .setReuseAddr(true);
 
  • Field Details

    • DEFAULT_HOST

      public static final String DEFAULT_HOST
      See Also:
    • DEFAULT_PORT

      public static final int DEFAULT_PORT
      See Also:
    • DEFAULT_REUSE_ADDR

      public static final boolean DEFAULT_REUSE_ADDR
      See Also:
    • DEFAULT_REUSE_PORT

      public static final boolean DEFAULT_REUSE_PORT
      See Also:
    • DEFAULT_RESOLUTION

      public static final Duration DEFAULT_RESOLUTION
    • DEFAULT_REQUEST_TIMEOUT

      public static final Duration DEFAULT_REQUEST_TIMEOUT
    • DEFAULT_READ_BUFFER_SIZE

      public static final int DEFAULT_READ_BUFFER_SIZE
      See Also:
    • DEFAULT_ACCEPT_LENGTH

      public static final int DEFAULT_ACCEPT_LENGTH
      See Also:
    • DEFAULT_MAX_REQUEST_SIZE

      public static final int DEFAULT_MAX_REQUEST_SIZE
      See Also:
    • DEFAULT_CONCURRENCY

      public static final int DEFAULT_CONCURRENCY
  • Constructor Details

    • HttpOptions

      public HttpOptions()
  • Method Details

    • getHost

      public String getHost()
      Retrieves the host address currently set for HTTP connections.
      Returns:
      the host address as a string
    • setHost

      public HttpOptions setHost(String host)
      Sets the host address for HTTP connections.
      Parameters:
      host - the string representation of the host address
      Returns:
      the HttpOptions instance for method chaining
    • getPort

      public int getPort()
      Retrieves the port number currently set for HTTP connections.
      Returns:
      the port number
    • setPort

      public HttpOptions setPort(int port)
      Sets the port number for HTTP connections.
      Parameters:
      port - the port number
      Returns:
      the HttpOptions instance for method chaining
    • isReuseAddr

      public boolean isReuseAddr()
      Returns whether the reuse address flag is enabled for the HTTP connections.
      Returns:
      true if the flag is enabled, false otherwise.
    • setReuseAddr

      public HttpOptions setReuseAddr(boolean reuseAddr)
      Sets the reuse address flag for the HTTP connections.
      Parameters:
      reuseAddr - the value to set for the reuse address flag
      Returns:
      the HttpOptions object itself, for method chaining
    • isReusePort

      public boolean isReusePort()
      Returns the value of the reuse port flag for the HTTP connections.
      Returns:
      the value of the reuse port flag
    • setReusePort

      public HttpOptions setReusePort(boolean reusePort)
      Sets the value of the reuse port flag for the HTTP connections.
      Parameters:
      reusePort - the value to be set for the reuse port flag
      Returns:
      the HttpOptions object itself, for method chaining
    • getResolution

      public Duration getResolution()
      Retrieves the resolution duration for HTTP connections.
      Returns:
      the resolution as a Duration
    • setResolution

      public HttpOptions setResolution(Duration resolution)
      Sets the resolution duration for HTTP connections.
      Parameters:
      resolution - the resolution as a Duration
      Returns:
      the HttpOptions instance for method chaining
    • getRequestTimeout

      public Duration getRequestTimeout()
      Retrieves the request timeout duration for HTTP operations.
      Returns:
      the request timeout as a Duration
    • setRequestTimeout

      public HttpOptions setRequestTimeout(Duration requestTimeout)
      Sets the request timeout duration for HTTP operations.
      Parameters:
      requestTimeout - the request timeout as a Duration
      Returns:
      the HttpOptions instance for method chaining
    • getReadBufferSize

      public int getReadBufferSize()
      Retrieves the size of the read buffer for HTTP connections.
      Returns:
      the read buffer size in bytes
    • setReadBufferSize

      public HttpOptions setReadBufferSize(int readBufferSize)
      Sets the size of the read buffer for HTTP connections.
      Parameters:
      readBufferSize - the size of the read buffer in bytes
      Returns:
      the HttpOptions instance for method chaining
    • getAcceptLength

      public int getAcceptLength()
      Retrieves the maximum length of the accept queue for incoming connections.
      Returns:
      the accept length (queue size)
    • setAcceptLength

      public HttpOptions setAcceptLength(int acceptLength)
      Sets the maximum length of the accept queue for incoming connections.
      Parameters:
      acceptLength - the length of the accept queue
      Returns:
      the HttpOptions instance for method chaining
    • getMaxRequestSize

      public int getMaxRequestSize()
      Retrieves the maximum size for HTTP requests.
      Returns:
      the maximum size of an HTTP request in bytes
    • setMaxRequestSize

      public HttpOptions setMaxRequestSize(int maxRequestSize)
      Sets the maximum size for HTTP requests.
      Parameters:
      maxRequestSize - the maximum size in bytes for an HTTP request
      Returns:
      the HttpOptions instance for method chaining
    • getConcurrency

      public int getConcurrency()
      Retrieves the level of concurrency for HTTP operations.
      Returns:
      the concurrency level
    • setConcurrency

      public HttpOptions setConcurrency(int concurrency)
      Sets the level of concurrency for HTTP operations.
      Parameters:
      concurrency - the concurrency level to set
      Returns:
      the HttpOptions instance for method chaining
    • toJSON

      public org.json.JSONObject toJSON()
      Converts the current settings of HttpOptions to a JSON representation. This is useful for debugging or storing the configuration state.
      Specified by:
      toJSON in interface Options
      Returns:
      a JSONObject representing the current configuration settings.