Package net.officefloor.server.http
Class HttpServer
java.lang.Object
net.officefloor.server.http.HttpServer
HTTP Server.
- Author:
- Daniel Sagenschneider
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic StringClassname of the defaultHttpServerImplementation.static final Stringstatic final Stringstatic final StringName ofPropertyto include the stack trace.static final StringName ofPropertyfor theSslContextSource.static final StringValue forPROPERTY_SSL_CONTEXT_SOURCEto indicate that this server is behind a reverse proxy. -
Constructor Summary
ConstructorsConstructorDescriptionHttpServer(DeployedOfficeInput serviceInput, String typeQualifier, OfficeFloorDeployer officeFloorDeployer, OfficeFloorSourceContext context) Instantiates theHttpServerfrom configuration.HttpServer(DeployedOfficeInput serviceInput, OfficeFloorDeployer officeFloorDeployer, OfficeFloorSourceContext context) Instantiates theHttpServerfrom configuration.HttpServer(HttpServerImplementation implementation, String typeQualifier, HttpServerLocation serverLocation, String serverName, DateHttpHeaderClock dateHttpHeaderClock, boolean isIncludeEscalationStackTrace, SSLContext sslContext, DeployedOfficeInput serviceInput, OfficeFloorDeployer officeFloorDeployer, OfficeFloorSourceContext context) Instantiates theHttpServerfrom direct configuration. -
Method Summary
Modifier and TypeMethodDescriptionObtains theHttpServerImplementation.Obtains theHttpServerLocation.static intgetPropertyInteger(String propertyName, SourceContext context, Supplier<Integer> defaultValue) Obtains thePropertyvalue.static StringgetPropertyString(String propertyName, SourceContext context, Supplier<String> defaultValue) Obtains thePropertyvalue.static HttpHeaderValuegetServerHttpHeaderValue(HttpServerImplementationContext context, String suffix) Convenience method to obtain theServerHttpHeaderValue.Obtains theSSLContext.static SSLContextgetSslContext(SourceContext context) Obtains theSSLContextfrom configuration.
-
Field Details
-
PROPERTY_HTTP_SERVER_NAME
- See Also:
-
PROPERTY_HTTP_DATE_HEADER
- See Also:
-
PROPERTY_INCLUDE_STACK_TRACE
Name ofPropertyto include the stack trace.- See Also:
-
PROPERTY_SSL_CONTEXT_SOURCE
Name ofPropertyfor theSslContextSource.- See Also:
-
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:
-
DEFAULT_HTTP_SERVER_IMPLEMENTATION_CLASS_NAME
Classname of the defaultHttpServerImplementation.
-
-
Constructor Details
-
HttpServer
public HttpServer(DeployedOfficeInput serviceInput, OfficeFloorDeployer officeFloorDeployer, OfficeFloorSourceContext context) throws Exception Instantiates theHttpServerfrom configuration.- Parameters:
serviceInput-DeployedOfficeInputservicing theServerHttpConnection.officeFloorDeployer-OfficeFloorDeployer.context-OfficeFloorSourceContext.- Throws:
Exception- If fails to create theHttpServerfrom configuration.
-
HttpServer
public HttpServer(DeployedOfficeInput serviceInput, String typeQualifier, OfficeFloorDeployer officeFloorDeployer, OfficeFloorSourceContext context) throws Exception Instantiates theHttpServerfrom configuration.- Parameters:
serviceInput-DeployedOfficeInputservicing theServerHttpConnection.typeQualifier- Type qualifier for theExternalServiceInput.officeFloorDeployer-OfficeFloorDeployer.context-OfficeFloorSourceContext.- Throws:
Exception- If fails to create theHttpServerfrom configuration.
-
HttpServer
public HttpServer(HttpServerImplementation implementation, String typeQualifier, HttpServerLocation serverLocation, String serverName, DateHttpHeaderClock dateHttpHeaderClock, boolean isIncludeEscalationStackTrace, SSLContext sslContext, DeployedOfficeInput serviceInput, OfficeFloorDeployer officeFloorDeployer, OfficeFloorSourceContext context) throws Exception Instantiates theHttpServerfrom direct configuration.- Parameters:
implementation-HttpServerImplementation.typeQualifier- Type qualifier for theExternalServiceInput.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:
Exception- If fails to configure theHttpServerImplementation.
-
-
Method Details
-
getPropertyString
public static String getPropertyString(String propertyName, SourceContext context, Supplier<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(String propertyName, SourceContext context, Supplier<Integer> defaultValue) Obtains thePropertyvalue.- Parameters:
propertyName- Name ofProperty.context-SourceContext.defaultValue-Supplierof the default value.- Returns:
- Value for the
Property.
-
getSslContext
Obtains theSSLContextfrom configuration.- Parameters:
context-SourceContext.- Returns:
SSLContext.- Throws:
Exception- If fails to load theSSLContextfrom configuration.
-
getServerHttpHeaderValue
public static HttpHeaderValue getServerHttpHeaderValue(HttpServerImplementationContext context, String suffix) Convenience method to obtain theServerHttpHeaderValue.- Parameters:
context-HttpServerImplementationContext.suffix- Optional suffix. May benull.- Returns:
ServerHttpHeaderValueornullif not configured.
-
getHttpServerLocation
Obtains theHttpServerLocation.- Returns:
HttpServerLocation.
-
getHttpServerImplementation
Obtains theHttpServerImplementation.- Returns:
HttpServerImplementation.
-
getSslContext
Obtains theSSLContext.- Returns:
SSLContext.
-