Class WebServerConfiguration
java.lang.Object
com.github.toolarium.jwebserver.config.WebServerConfiguration
- All Implemented Interfaces:
IWebServerConfiguration
Define the webserver configuration
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor for WebServerConfigurationWebServerConfiguration(IWebServerConfiguration webServerConfiguration) Constructor for WebServerConfiguration -
Method Summary
Modifier and TypeMethodDescriptionThe access log file pattern, e.g.Get access log format string: %a - Remote IP address %A - Local IP address %b - Bytes sent, excluding HTTP headers, or '-' if no bytes were sent %B - Bytes sent, excluding HTTP headers %h - Remote host name %H - Request protocol %l - Remote logical username from identd (always returns '-') %m - Request method %o - Obfuscated remote IP address (IPv4: last byte removed, IPv6: cut off after second colon, ie.Get the basic authentication: user:passwordGet the health pathGet the hostnameintGet the number of I/O threadsgetPort()Get the portGet the proxy server configurationGet the resource pathGet the resource server configurationGet the secure portGet the ssl server configurationGet the verbose levelGet the webserver nameintGet the number of working threadsbooleanDefine if the resource has basic authenticationbooleanDefine if the server support healthbooleanTrue if it is a proxy serverRead the configuration from the classpathsetAccessLogFilePattern(String accessLogFilePattern) Set the access log file patternsetAccessLogFormatString(String accessLogFormatString) Set the access log format stringsetBasicAuthentication(String basicAuthentication) Define if basic authentication is enabledsetHealthPath(String healthPath) Set the health pathsetHostname(String hostname) Set the host namesetIoThreads(Integer ioThreads) Set the I/O threadsSet the portsetResourcePath(String resourcePath) Set the resource pathsetSecurePort(Integer securePort) Set the secure portsetVerboseLevel(VerboseLevel verboseLevel) Set the verbose levelsetWebserverName(String webserverName) Set the webserver namesetWorkerThreads(Integer workerThreads) Set the worker threadstoString()
-
Constructor Details
-
WebServerConfiguration
public WebServerConfiguration()Constructor for WebServerConfiguration -
WebServerConfiguration
Constructor for WebServerConfiguration- Parameters:
webServerConfiguration- the web server configuration
-
-
Method Details
-
getWebserverName
Description copied from interface:IWebServerConfigurationGet the webserver name- Specified by:
getWebserverNamein interfaceIWebServerConfiguration- Returns:
- the webserver name
- See Also:
-
setWebserverName
Set the webserver name- Parameters:
webserverName- the webserve name- Returns:
- the WebServerConfiguration
-
getHostname
Description copied from interface:IWebServerConfigurationGet the hostname- Specified by:
getHostnamein interfaceIWebServerConfiguration- Returns:
- the hostname
- See Also:
-
setHostname
Set the host name- Parameters:
hostname- the hostname- Returns:
- the WebServerConfiguration
-
getPort
Description copied from interface:IWebServerConfigurationGet the port- Specified by:
getPortin interfaceIWebServerConfiguration- Returns:
- the port
- See Also:
-
setPort
Set the port- Parameters:
port- the port- Returns:
- the WebServerConfiguration
-
getSecurePort
Description copied from interface:IWebServerConfigurationGet the secure port- Specified by:
getSecurePortin interfaceIWebServerConfiguration- Returns:
- the secure port
- See Also:
-
setSecurePort
Set the secure port- Parameters:
securePort- the secure port- Returns:
- the WebServerConfiguration
-
getVerboseLevel
Description copied from interface:IWebServerConfigurationGet the verbose level- Specified by:
getVerboseLevelin interfaceIWebServerConfiguration- Returns:
- the verbose level
- See Also:
-
setVerboseLevel
Set the verbose level- Parameters:
verboseLevel- the verbose level- Returns:
- the WebServerConfiguration
-
getAccessLogFormatString
Description copied from interface:IWebServerConfigurationGet access log format string:- %a - Remote IP address
- %A - Local IP address
- %b - Bytes sent, excluding HTTP headers, or '-' if no bytes were sent
- %B - Bytes sent, excluding HTTP headers
- %h - Remote host name
- %H - Request protocol
- %l - Remote logical username from identd (always returns '-')
- %m - Request method
- %o - Obfuscated remote IP address (IPv4: last byte removed, IPv6: cut off after second colon, ie. '1.2.3.' or 'fe08:44:')
- %p - Local port
- %q - Query string (excluding the '?' character)
- %r - First line of the request
- %s - HTTP status code of the response
- %t - Date and time, in Common Log Format format
- %u - Remote user that was authenticated
- %U - Requested URL path
- %v - Local server name
- %D - Time taken to process the request, in millis
- %T - Time taken to process the request, in seconds
- %I - current Request thread name (can compare later with stacktraces)
In addition, the caller can specify one of the following aliases for commonly utilized patterns:
- common -
%h %l %u %t "%r" %s %b - combined -
%h %l %u %t "%r" %s %b "%{i,Referer}" "%{i,User-Agent}" - commonobf -
%o %l %u %t "%r" %s %b - combinedobf -
%o %l %u %t "%r" %s %b "%{i,Referer}" "%{i,User-Agent}"
There is also support to write information from the cookie, incoming header, or the session
It is modeled after the apache syntax:%{i,xxx}for incoming headers%{o,xxx}for outgoing response headers%{c,xxx}for a specific cookie%{r,xxx}xxx is an attribute in the ServletRequest%{s,xxx}xxx is an attribute in the HttpSession
- Specified by:
getAccessLogFormatStringin interfaceIWebServerConfiguration- Returns:
- the accesslog format string
- See Also:
-
setAccessLogFormatString
Set the access log format string- Parameters:
accessLogFormatString- the access log format string- Returns:
- the WebServerConfiguration
-
getAccessLogFilePattern
Description copied from interface:IWebServerConfigurationThe access log file pattern, e.g. "access-%d{yyyy-MM-dd}.log.gz"For more information, please refer to the online manual at http://logback.qos.ch/manual/appenders.html#TimeBasedRollingPolicy
- Specified by:
getAccessLogFilePatternin interfaceIWebServerConfiguration- Returns:
- the access log file pattern
- See Also:
-
setAccessLogFilePattern
Set the access log file pattern- Parameters:
accessLogFilePattern- the access log file pattern- Returns:
- the WebServerConfiguration
-
hasBasicAuthentication
public boolean hasBasicAuthentication()Description copied from interface:IWebServerConfigurationDefine if the resource has basic authentication- Specified by:
hasBasicAuthenticationin interfaceIWebServerConfiguration- Returns:
- true if it is enabled
- See Also:
-
getBasicAuthentication
Description copied from interface:IWebServerConfigurationGet the basic authentication: user:password- Specified by:
getBasicAuthenticationin interfaceIWebServerConfiguration- Returns:
- the basic authentication
- See Also:
-
setBasicAuthentication
Define if basic authentication is enabled- Parameters:
basicAuthentication- true if basic authentication is enabled- Returns:
- the WebServerConfiguration
-
hasHealthCheck
public boolean hasHealthCheck()Description copied from interface:IWebServerConfigurationDefine if the server support health- Specified by:
hasHealthCheckin interfaceIWebServerConfiguration- Returns:
- true if it is enabled
- See Also:
-
getHealthPath
Description copied from interface:IWebServerConfigurationGet the health path- Specified by:
getHealthPathin interfaceIWebServerConfiguration- Returns:
- the health path
- See Also:
-
setHealthPath
Set the health path- Parameters:
healthPath- the resource path- Returns:
- the WebServerConfiguration
-
getIoThreads
public int getIoThreads()Description copied from interface:IWebServerConfigurationGet the number of I/O threads- Specified by:
getIoThreadsin interfaceIWebServerConfiguration- Returns:
- the number of I/O threads
- See Also:
-
setIoThreads
Set the I/O threads- Parameters:
ioThreads- the io threads- Returns:
- the WebServerConfiguration
-
getWorkerThreads
public int getWorkerThreads()Description copied from interface:IWebServerConfigurationGet the number of working threads- Specified by:
getWorkerThreadsin interfaceIWebServerConfiguration- Returns:
- the number of working threads
- See Also:
-
setWorkerThreads
Set the worker threads- Parameters:
workerThreads- the worker threads- Returns:
- the WebServerConfiguration
-
getResourcePath
Description copied from interface:IWebServerConfigurationGet the resource path- Specified by:
getResourcePathin interfaceIWebServerConfiguration- Returns:
- the resource path
- See Also:
-
setResourcePath
Set the resource path- Parameters:
resourcePath- the resource path- Returns:
- the ResourceServerConfiguration
-
getSSLServerConfiguration
Description copied from interface:IWebServerConfigurationGet the ssl server configuration- Specified by:
getSSLServerConfigurationin interfaceIWebServerConfiguration- Returns:
- the ssl server configuration
- See Also:
-
getResourceServerConfiguration
Description copied from interface:IWebServerConfigurationGet the resource server configuration- Specified by:
getResourceServerConfigurationin interfaceIWebServerConfiguration- Returns:
- the resource server configuration
- See Also:
-
getProxyServerConfiguration
Description copied from interface:IWebServerConfigurationGet the proxy server configuration- Specified by:
getProxyServerConfigurationin interfaceIWebServerConfiguration- Returns:
- the proxy server configuration
- See Also:
-
isProxyServer
public boolean isProxyServer()Description copied from interface:IWebServerConfigurationTrue if it is a proxy server- Specified by:
isProxyServerin interfaceIWebServerConfiguration- Returns:
- true if it is a proxy server
- See Also:
-
readProperties
Read the configuration from the classpath- Returns:
- the WebServerConfiguration
-
toString
-