Class WebServerConfiguration
- java.lang.Object
-
- com.github.toolarium.jwebserver.config.WebServerConfiguration
-
- All Implemented Interfaces:
IWebServerConfiguration
public class WebServerConfiguration extends java.lang.Object implements IWebServerConfiguration
Define the webserver configuration
-
-
Constructor Summary
Constructors Constructor Description WebServerConfiguration()Constructor for WebServerConfigurationWebServerConfiguration(IWebServerConfiguration webServerConfiguration)Constructor for WebServerConfiguration
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetAccessLogFilePattern()The access log file pattern, e.g.java.lang.StringgetAccessLogFormatString()Get access log format string:java.lang.StringgetBasicAuthentication()Get the basic authentication: user:passwordjava.lang.StringgetHealthPath()Get the health pathjava.lang.StringgetHostname()Get the hostnameintgetIoThreads()Get the number of I/O threadsjava.lang.IntegergetPort()Get the portProxyServerConfigurationgetProxyServerConfiguration()Get the proxy server configurationjava.lang.StringgetResourcePath()Get the resource pathResourceServerConfigurationgetResourceServerConfiguration()Get the resource server configurationjava.lang.IntegergetSecurePort()Get the secure portSSLServerConfigurationgetSSLServerConfiguration()Get the ssl server configurationVerboseLevelgetVerboseLevel()Get the verbose leveljava.lang.StringgetWebserverName()Get the webserver nameintgetWorkerThreads()Get the number of working threadsbooleanhasBasicAuthentication()Define if the resource has basic authenticationbooleanhasHealthCheck()Define if the server support healthbooleanisProxyServer()True if it is a proxy serverWebServerConfigurationreadProperties()Read the configuration from the classpathWebServerConfigurationsetAccessLogFilePattern(java.lang.String accessLogFilePattern)Set the access log file patternWebServerConfigurationsetAccessLogFormatString(java.lang.String accessLogFormatString)Set the access log format stringWebServerConfigurationsetBasicAuthentication(java.lang.String basicAuthentication)Define if basic authentication is enabledWebServerConfigurationsetHealthPath(java.lang.String healthPath)Set the health pathWebServerConfigurationsetHostname(java.lang.String hostname)Set the host nameWebServerConfigurationsetIoThreads(java.lang.Integer ioThreads)Set the I/O threadsWebServerConfigurationsetPort(java.lang.Integer port)Set the portWebServerConfigurationsetResourcePath(java.lang.String resourcePath)Set the resource pathWebServerConfigurationsetSecurePort(java.lang.Integer securePort)Set the secure portWebServerConfigurationsetVerboseLevel(VerboseLevel verboseLevel)Set the verbose levelWebServerConfigurationsetWebserverName(java.lang.String webserverName)Set the webserver nameWebServerConfigurationsetWorkerThreads(java.lang.Integer workerThreads)Set the worker threadsjava.lang.StringtoString()
-
-
-
Constructor Detail
-
WebServerConfiguration
public WebServerConfiguration()
Constructor for WebServerConfiguration
-
WebServerConfiguration
public WebServerConfiguration(IWebServerConfiguration webServerConfiguration)
Constructor for WebServerConfiguration- Parameters:
webServerConfiguration- the web server configuration
-
-
Method Detail
-
getWebserverName
public java.lang.String getWebserverName()
Description copied from interface:IWebServerConfigurationGet the webserver name- Specified by:
getWebserverNamein interfaceIWebServerConfiguration- Returns:
- the webserver name
- See Also:
IWebServerConfiguration.getWebserverName()
-
setWebserverName
public WebServerConfiguration setWebserverName(java.lang.String webserverName)
Set the webserver name- Parameters:
webserverName- the webserve name- Returns:
- the WebServerConfiguration
-
getHostname
public java.lang.String getHostname()
Description copied from interface:IWebServerConfigurationGet the hostname- Specified by:
getHostnamein interfaceIWebServerConfiguration- Returns:
- the hostname
- See Also:
IWebServerConfiguration.getHostname()
-
setHostname
public WebServerConfiguration setHostname(java.lang.String hostname)
Set the host name- Parameters:
hostname- the hostname- Returns:
- the WebServerConfiguration
-
getPort
public java.lang.Integer getPort()
Description copied from interface:IWebServerConfigurationGet the port- Specified by:
getPortin interfaceIWebServerConfiguration- Returns:
- the port
- See Also:
IWebServerConfiguration.getPort()
-
setPort
public WebServerConfiguration setPort(java.lang.Integer port)
Set the port- Parameters:
port- the port- Returns:
- the WebServerConfiguration
-
getSecurePort
public java.lang.Integer getSecurePort()
Description copied from interface:IWebServerConfigurationGet the secure port- Specified by:
getSecurePortin interfaceIWebServerConfiguration- Returns:
- the secure port
- See Also:
IWebServerConfiguration.getSecurePort()
-
setSecurePort
public WebServerConfiguration setSecurePort(java.lang.Integer securePort)
Set the secure port- Parameters:
securePort- the secure port- Returns:
- the WebServerConfiguration
-
getVerboseLevel
public VerboseLevel getVerboseLevel()
Description copied from interface:IWebServerConfigurationGet the verbose level- Specified by:
getVerboseLevelin interfaceIWebServerConfiguration- Returns:
- the verbose level
- See Also:
IWebServerConfiguration.getVerboseLevel()
-
setVerboseLevel
public WebServerConfiguration setVerboseLevel(VerboseLevel verboseLevel)
Set the verbose level- Parameters:
verboseLevel- the verbose level- Returns:
- the WebServerConfiguration
-
getAccessLogFormatString
public java.lang.String 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:
IWebServerConfiguration.getAccessLogFormatString()
-
setAccessLogFormatString
public WebServerConfiguration setAccessLogFormatString(java.lang.String accessLogFormatString)
Set the access log format string- Parameters:
accessLogFormatString- the access log format string- Returns:
- the WebServerConfiguration
-
getAccessLogFilePattern
public java.lang.String 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:
IWebServerConfiguration.getAccessLogFilePattern()
-
setAccessLogFilePattern
public WebServerConfiguration setAccessLogFilePattern(java.lang.String accessLogFilePattern)
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:
IWebServerConfiguration.hasBasicAuthentication()
-
getBasicAuthentication
public java.lang.String getBasicAuthentication()
Description copied from interface:IWebServerConfigurationGet the basic authentication: user:password- Specified by:
getBasicAuthenticationin interfaceIWebServerConfiguration- Returns:
- the basic authentication
- See Also:
IWebServerConfiguration.getBasicAuthentication()
-
setBasicAuthentication
public WebServerConfiguration setBasicAuthentication(java.lang.String basicAuthentication)
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:
IWebServerConfiguration.hasHealthCheck()
-
getHealthPath
public java.lang.String getHealthPath()
Description copied from interface:IWebServerConfigurationGet the health path- Specified by:
getHealthPathin interfaceIWebServerConfiguration- Returns:
- the health path
- See Also:
IWebServerConfiguration.getHealthPath()
-
setHealthPath
public WebServerConfiguration setHealthPath(java.lang.String healthPath)
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:
IWebServerConfiguration.getIoThreads()
-
setIoThreads
public WebServerConfiguration setIoThreads(java.lang.Integer ioThreads)
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:
IWebServerConfiguration.getWorkerThreads()
-
setWorkerThreads
public WebServerConfiguration setWorkerThreads(java.lang.Integer workerThreads)
Set the worker threads- Parameters:
workerThreads- the worker threads- Returns:
- the WebServerConfiguration
-
getResourcePath
public java.lang.String getResourcePath()
Description copied from interface:IWebServerConfigurationGet the resource path- Specified by:
getResourcePathin interfaceIWebServerConfiguration- Returns:
- the resource path
- See Also:
IWebServerConfiguration.getResourcePath()
-
setResourcePath
public WebServerConfiguration setResourcePath(java.lang.String resourcePath)
Set the resource path- Parameters:
resourcePath- the resource path- Returns:
- the ResourceServerConfiguration
-
getSSLServerConfiguration
public SSLServerConfiguration getSSLServerConfiguration()
Description copied from interface:IWebServerConfigurationGet the ssl server configuration- Specified by:
getSSLServerConfigurationin interfaceIWebServerConfiguration- Returns:
- the ssl server configuration
- See Also:
IWebServerConfiguration.getSSLServerConfiguration()
-
getResourceServerConfiguration
public ResourceServerConfiguration getResourceServerConfiguration()
Description copied from interface:IWebServerConfigurationGet the resource server configuration- Specified by:
getResourceServerConfigurationin interfaceIWebServerConfiguration- Returns:
- the resource server configuration
- See Also:
IWebServerConfiguration.getResourceServerConfiguration()
-
getProxyServerConfiguration
public ProxyServerConfiguration getProxyServerConfiguration()
Description copied from interface:IWebServerConfigurationGet the proxy server configuration- Specified by:
getProxyServerConfigurationin interfaceIWebServerConfiguration- Returns:
- the proxy server configuration
- See Also:
IWebServerConfiguration.getProxyServerConfiguration()
-
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:
IWebServerConfiguration.isProxyServer()
-
readProperties
public WebServerConfiguration readProperties()
Read the configuration from the classpath- Returns:
- the WebServerConfiguration
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object- See Also:
Object.toString()
-
-