java.lang.Object
one.jpro.platform.auth.core.http.HttpOptions
- All Implemented Interfaces:
Options
Represents configuration options for
HttpServer configuration.
Usage example:
HttpOptions options = new HttpOptions()
.setHost("127.0.0.1")
.setPort(8080)
.setReuseAddr(true);
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintRetrieves the maximum length of the accept queue for incoming connections.intRetrieves the level of concurrency for HTTP operations.getHost()Retrieves the host address currently set for HTTP connections.intRetrieves the maximum size for HTTP requests.intgetPort()Retrieves the port number currently set for HTTP connections.intRetrieves the size of the read buffer for HTTP connections.Retrieves the request timeout duration for HTTP operations.Retrieves the resolution duration for HTTP connections.booleanReturns whether the reuse address flag is enabled for the HTTP connections.booleanReturns the value of the reuse port flag for the HTTP connections.setAcceptLength(int acceptLength) Sets the maximum length of the accept queue for incoming connections.setConcurrency(int concurrency) Sets the level of concurrency for HTTP operations.Sets the host address for HTTP connections.setMaxRequestSize(int maxRequestSize) Sets the maximum size for HTTP requests.setPort(int port) Sets the port number for HTTP connections.setReadBufferSize(int readBufferSize) Sets the size of the read buffer for HTTP connections.setRequestTimeout(Duration requestTimeout) Sets the request timeout duration for HTTP operations.setResolution(Duration resolution) Sets the resolution duration for HTTP connections.setReuseAddr(boolean reuseAddr) Sets the reuse address flag for the HTTP connections.setReusePort(boolean reusePort) Sets the value of the reuse port flag for the HTTP connections.org.json.JSONObjecttoJSON()Converts the current settings ofHttpOptionsto a JSON representation.
-
Field Details
-
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
-
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
Retrieves the host address currently set for HTTP connections.- Returns:
- the host address as a string
-
setHost
Sets the host address for HTTP connections.- Parameters:
host- the string representation of the host address- Returns:
- the
HttpOptionsinstance for method chaining
-
getPort
public int getPort()Retrieves the port number currently set for HTTP connections.- Returns:
- the port number
-
setPort
Sets the port number for HTTP connections.- Parameters:
port- the port number- Returns:
- the
HttpOptionsinstance for method chaining
-
isReuseAddr
public boolean isReuseAddr()Returns whether the reuse address flag is enabled for the HTTP connections.- Returns:
trueif the flag is enabled,falseotherwise.
-
setReuseAddr
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
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
Retrieves the resolution duration for HTTP connections.- Returns:
- the resolution as a
Duration
-
setResolution
Sets the resolution duration for HTTP connections.- Parameters:
resolution- the resolution as aDuration- Returns:
- the
HttpOptionsinstance for method chaining
-
getRequestTimeout
Retrieves the request timeout duration for HTTP operations.- Returns:
- the request timeout as a
Duration
-
setRequestTimeout
Sets the request timeout duration for HTTP operations.- Parameters:
requestTimeout- the request timeout as aDuration- Returns:
- the
HttpOptionsinstance 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
Sets the size of the read buffer for HTTP connections.- Parameters:
readBufferSize- the size of the read buffer in bytes- Returns:
- the
HttpOptionsinstance 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
Sets the maximum length of the accept queue for incoming connections.- Parameters:
acceptLength- the length of the accept queue- Returns:
- the
HttpOptionsinstance 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
Sets the maximum size for HTTP requests.- Parameters:
maxRequestSize- the maximum size in bytes for an HTTP request- Returns:
- the
HttpOptionsinstance for method chaining
-
getConcurrency
public int getConcurrency()Retrieves the level of concurrency for HTTP operations.- Returns:
- the concurrency level
-
setConcurrency
Sets the level of concurrency for HTTP operations.- Parameters:
concurrency- the concurrency level to set- Returns:
- the
HttpOptionsinstance for method chaining
-
toJSON
public org.json.JSONObject toJSON()Converts the current settings ofHttpOptionsto a JSON representation. This is useful for debugging or storing the configuration state.
-