Package net.officefloor.server.http
Class HttpServer
- java.lang.Object
-
- net.officefloor.server.http.HttpServer
-
public class HttpServer extends java.lang.ObjectHTTP Server.- Author:
- Daniel Sagenschneider
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDEFAULT_HTTP_SERVER_IMPLEMENTATION_CLASS_NAMEClassname of the defaultHttpServerImplementation.static java.lang.StringPROPERTY_HTTP_DATE_HEADERstatic java.lang.StringPROPERTY_HTTP_SERVER_NAMEstatic java.lang.StringPROPERTY_INCLUDE_STACK_TRACEName ofPropertyto include the stack trace.static java.lang.StringPROPERTY_SSL_CONTEXT_SOURCEName ofPropertyfor theSslContextSource.static java.lang.StringSSL_REVERSE_PROXIEDValue forPROPERTY_SSL_CONTEXT_SOURCEto indicate that this server is behind a reverse proxy.
-
Constructor Summary
Constructors Constructor Description HttpServer(DeployedOfficeInput serviceInput, OfficeFloorDeployer officeFloorDeployer, OfficeFloorSourceContext context)Instantiates theHttpServerfrom configuration.HttpServer(HttpServerImplementation implementation, HttpServerLocation serverLocation, java.lang.String serverName, DateHttpHeaderClock dateHttpHeaderClock, boolean isIncludeEscalationStackTrace, javax.net.ssl.SSLContext sslContext, DeployedOfficeInput serviceInput, OfficeFloorDeployer officeFloorDeployer, OfficeFloorSourceContext context)Instantiates theHttpServerfrom direct configuration.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description HttpServerImplementationgetHttpServerImplementation()Obtains theHttpServerImplementation.HttpServerLocationgetHttpServerLocation()Obtains theHttpServerLocation.static intgetPropertyInteger(java.lang.String propertyName, SourceContext context, java.util.function.Supplier<java.lang.Integer> defaultValue)Obtains thePropertyvalue.static java.lang.StringgetPropertyString(java.lang.String propertyName, SourceContext context, java.util.function.Supplier<java.lang.String> defaultValue)Obtains thePropertyvalue.static HttpHeaderValuegetServerHttpHeaderValue(HttpServerImplementationContext context, java.lang.String suffix)Convenience method to obtain theServerHttpHeaderValue.javax.net.ssl.SSLContextgetSslContext()Obtains theSSLContext.static javax.net.ssl.SSLContextgetSslContext(SourceContext context)Obtains theSSLContextfrom configuration.
-
-
-
Field Detail
-
PROPERTY_HTTP_SERVER_NAME
public static final java.lang.String PROPERTY_HTTP_SERVER_NAME
- See Also:
- Constant Field Values
-
PROPERTY_HTTP_DATE_HEADER
public static final java.lang.String PROPERTY_HTTP_DATE_HEADER
- See Also:
- Constant Field Values
-
PROPERTY_INCLUDE_STACK_TRACE
public static final java.lang.String PROPERTY_INCLUDE_STACK_TRACE
Name ofPropertyto include the stack trace.- See Also:
- Constant Field Values
-
PROPERTY_SSL_CONTEXT_SOURCE
public static final java.lang.String PROPERTY_SSL_CONTEXT_SOURCE
Name ofPropertyfor theSslContextSource.- See Also:
- Constant Field Values
-
SSL_REVERSE_PROXIED
public static final java.lang.String SSL_REVERSE_PROXIED
Value forPROPERTY_SSL_CONTEXT_SOURCEto indicate that this server is behind a reverse proxy. This enables the reverse proxy to handle SSL and communicate with this server via insecureSocket(but stll appear as a secureServerHttpConnection).- See Also:
- Constant Field Values
-
DEFAULT_HTTP_SERVER_IMPLEMENTATION_CLASS_NAME
public static java.lang.String DEFAULT_HTTP_SERVER_IMPLEMENTATION_CLASS_NAME
Classname of the defaultHttpServerImplementation.
-
-
Constructor Detail
-
HttpServer
public HttpServer(DeployedOfficeInput serviceInput, OfficeFloorDeployer officeFloorDeployer, OfficeFloorSourceContext context) throws java.lang.Exception
Instantiates theHttpServerfrom configuration.- Parameters:
serviceInput-DeployedOfficeInputservicing theServerHttpConnection.officeFloorDeployer-OfficeFloorDeployer.context-OfficeFloorSourceContext.- Throws:
java.lang.Exception- If fails to create theHttpServerfrom configuration.
-
HttpServer
public HttpServer(HttpServerImplementation implementation, HttpServerLocation serverLocation, java.lang.String serverName, DateHttpHeaderClock dateHttpHeaderClock, boolean isIncludeEscalationStackTrace, javax.net.ssl.SSLContext sslContext, DeployedOfficeInput serviceInput, OfficeFloorDeployer officeFloorDeployer, OfficeFloorSourceContext context) throws java.lang.Exception
Instantiates theHttpServerfrom direct configuration.- Parameters:
implementation-HttpServerImplementation.serverLocation-HttpServerLocation.serverName- Server name. May benull.dateHttpHeaderClock-DateHttpHeaderClock. May benull.isIncludeEscalationStackTrace- Indicates whether to includeEscalationstack trace inHttpResponse.sslContext-SSLContext.serviceInput-DeployedOfficeInputservicing theServerHttpConnection.officeFloorDeployer-OfficeFloorDeployer.context-OfficeFloorSourceContext.- Throws:
java.lang.Exception- If fails to configure theHttpServerImplementation.
-
-
Method Detail
-
getPropertyString
public static java.lang.String getPropertyString(java.lang.String propertyName, SourceContext context, java.util.function.Supplier<java.lang.String> defaultValue)Obtains thePropertyvalue.- Parameters:
propertyName- Name ofProperty.context-SourceContext.defaultValue-Supplierof the default value.- Returns:
- Value for the
Property.
-
getPropertyInteger
public static int getPropertyInteger(java.lang.String propertyName, SourceContext context, java.util.function.Supplier<java.lang.Integer> defaultValue)Obtains thePropertyvalue.- Parameters:
propertyName- Name ofProperty.context-SourceContext.defaultValue-Supplierof the default value.- Returns:
- Value for the
Property.
-
getSslContext
public static javax.net.ssl.SSLContext getSslContext(SourceContext context) throws java.lang.Exception
Obtains theSSLContextfrom configuration.- Parameters:
context-SourceContext.- Returns:
SSLContext.- Throws:
java.lang.Exception- If fails to load theSSLContextfrom configuration.
-
getServerHttpHeaderValue
public static HttpHeaderValue getServerHttpHeaderValue(HttpServerImplementationContext context, java.lang.String suffix)
Convenience method to obtain theServerHttpHeaderValue.- Parameters:
context-HttpServerImplementationContext.suffix- Optional suffix. May benull.- Returns:
ServerHttpHeaderValueornullif not configured.
-
getHttpServerLocation
public HttpServerLocation getHttpServerLocation()
Obtains theHttpServerLocation.- Returns:
HttpServerLocation.
-
getHttpServerImplementation
public HttpServerImplementation getHttpServerImplementation()
Obtains theHttpServerImplementation.- Returns:
HttpServerImplementation.
-
getSslContext
public javax.net.ssl.SSLContext getSslContext()
Obtains theSSLContext.- Returns:
SSLContext.
-
-