Package net.officefloor.server.http
Class HttpServerSocketManagedObjectSource
- java.lang.Object
-
- net.officefloor.frame.api.managedobject.source.impl.AbstractAsyncManagedObjectSource<O,F>
-
- net.officefloor.frame.api.managedobject.source.impl.AbstractManagedObjectSource<None,Indexed>
-
- net.officefloor.server.http.HttpServerSocketManagedObjectSource
-
- All Implemented Interfaces:
ManagedFunction<Indexed,None>,ManagedObjectSource<None,Indexed>
@PrivateSource public class HttpServerSocketManagedObjectSource extends AbstractManagedObjectSource<None,Indexed> implements ManagedFunction<Indexed,None>
- Author:
- Daniel Sagenschneider
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class net.officefloor.frame.api.managedobject.source.impl.AbstractAsyncManagedObjectSource
AbstractAsyncManagedObjectSource.DependencyLabeller<K extends java.lang.Enum<K>>, AbstractAsyncManagedObjectSource.ExecutionLabeller, AbstractAsyncManagedObjectSource.Labeller<K extends java.lang.Enum<K>>, AbstractAsyncManagedObjectSource.MetaDataContext<O extends java.lang.Enum<O>,F extends java.lang.Enum<F>>, AbstractAsyncManagedObjectSource.SpecificationContext
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringHANDLE_REQUEST_FLOW_NAMEName of theFlowto handle the request.static java.lang.StringPROPERTY_MAX_ENTITY_LENGTHName ofPropertyfor the maximum entity length for HTTP parsing.static java.lang.StringPROPERTY_MAX_HEADER_COUNTstatic java.lang.StringPROPERTY_MAX_TEXT_LENGTHName ofPropertyfor the maximum text length for HTTP parsing.static java.lang.StringPROPERTY_SECUREName ofPropertyindicating if secure.static java.lang.StringPROPERTY_SERVICE_BUFFER_SIZEName ofPropertyfor the size of theStreamBufferinstances for the service.static java.lang.StringPROPERTY_SERVICE_MAX_CORE_POOL_SIZEName ofPropertyfor the maximum number ofStreamBufferinstances cached in a core pool.static java.lang.StringPROPERTY_SERVICE_MAX_THREAD_POOL_SIZEstatic java.lang.StringSSL_TEAM_NAMEName of theTeamto execute the SSL tasks.static java.lang.StringSYSTEM_PROPERTY_CORE_BUFFER_POOL_MAX_SIZEName ofSystemproperty to obtain the maximumThreadLocalStreamBufferPoolcore pool size.static java.lang.StringSYSTEM_PROPERTY_MAX_READS_ON_SELECTName ofSystemproperty to obtain the maximum number of reads for aSocketChannelper select.static java.lang.StringSYSTEM_PROPERTY_RECEIVE_BUFFER_SIZEName ofSystemproperty to obtain the receive buffer size of theSocket.static java.lang.StringSYSTEM_PROPERTY_SEND_BUFFER_SIZEName ofSystemproperty to obtain the send buffer size of theSocket.static java.lang.StringSYSTEM_PROPERTY_SOCKET_LISTENER_COUNTName ofSystemproperty to specify the number ofSocketServicerinstances.static java.lang.StringSYSTEM_PROPERTY_STREAM_BUFFER_SIZEName ofSystemproperty to obtain the pooledStreamBuffersize.static java.lang.StringSYSTEM_PROPERTY_THREADLOCAL_BUFFER_POOL_MAX_SIZE
-
Constructor Summary
Constructors Constructor Description HttpServerSocketManagedObjectSource()Default constructor to configure fromPropertyList.HttpServerSocketManagedObjectSource(HttpServerLocation serverLocation, HttpHeaderValue serverName, DateHttpHeaderClock dateHttpHeaderClock, boolean isIncludeEscalationStackTrace)Instantiate for non-secure servicing.HttpServerSocketManagedObjectSource(HttpServerLocation serverLocation, HttpHeaderValue serverName, DateHttpHeaderClock dateHttpHeaderClock, boolean isIncludeEscalationStackTrace, javax.net.ssl.SSLContext sslContext)Instantiate for secure servicing.
-
Method Summary
-
Methods inherited from class net.officefloor.frame.api.managedobject.source.impl.AbstractManagedObjectSource
sourceManagedObject
-
Methods inherited from class net.officefloor.frame.api.managedobject.source.impl.AbstractAsyncManagedObjectSource
getSpecification, init, stop
-
-
-
-
Field Detail
-
SYSTEM_PROPERTY_SOCKET_LISTENER_COUNT
public static final java.lang.String SYSTEM_PROPERTY_SOCKET_LISTENER_COUNT
Name ofSystemproperty to specify the number ofSocketServicerinstances. If not specified, will default toRuntime.availableProcessors().- See Also:
- Constant Field Values
-
SYSTEM_PROPERTY_STREAM_BUFFER_SIZE
public static final java.lang.String SYSTEM_PROPERTY_STREAM_BUFFER_SIZE
Name ofSystemproperty to obtain the pooledStreamBuffersize.- See Also:
- Constant Field Values
-
SYSTEM_PROPERTY_RECEIVE_BUFFER_SIZE
public static final java.lang.String SYSTEM_PROPERTY_RECEIVE_BUFFER_SIZE
Name ofSystemproperty to obtain the receive buffer size of theSocket.- See Also:
- Constant Field Values
-
SYSTEM_PROPERTY_MAX_READS_ON_SELECT
public static final java.lang.String SYSTEM_PROPERTY_MAX_READS_ON_SELECT
Name ofSystemproperty to obtain the maximum number of reads for aSocketChannelper select.- See Also:
- Constant Field Values
-
SYSTEM_PROPERTY_SEND_BUFFER_SIZE
public static final java.lang.String SYSTEM_PROPERTY_SEND_BUFFER_SIZE
Name ofSystemproperty to obtain the send buffer size of theSocket.- See Also:
- Constant Field Values
-
SYSTEM_PROPERTY_THREADLOCAL_BUFFER_POOL_MAX_SIZE
public static final java.lang.String SYSTEM_PROPERTY_THREADLOCAL_BUFFER_POOL_MAX_SIZE
- See Also:
- Constant Field Values
-
SYSTEM_PROPERTY_CORE_BUFFER_POOL_MAX_SIZE
public static final java.lang.String SYSTEM_PROPERTY_CORE_BUFFER_POOL_MAX_SIZE
Name ofSystemproperty to obtain the maximumThreadLocalStreamBufferPoolcore pool size.- See Also:
- Constant Field Values
-
PROPERTY_SECURE
public static final java.lang.String PROPERTY_SECURE
Name ofPropertyindicating if secure.- See Also:
- Constant Field Values
-
PROPERTY_MAX_HEADER_COUNT
public static final java.lang.String PROPERTY_MAX_HEADER_COUNT
- See Also:
- Constant Field Values
-
PROPERTY_MAX_TEXT_LENGTH
public static final java.lang.String PROPERTY_MAX_TEXT_LENGTH
Name ofPropertyfor the maximum text length for HTTP parsing.- See Also:
- Constant Field Values
-
PROPERTY_MAX_ENTITY_LENGTH
public static final java.lang.String PROPERTY_MAX_ENTITY_LENGTH
Name ofPropertyfor the maximum entity length for HTTP parsing.- See Also:
- Constant Field Values
-
PROPERTY_SERVICE_BUFFER_SIZE
public static final java.lang.String PROPERTY_SERVICE_BUFFER_SIZE
Name ofPropertyfor the size of theStreamBufferinstances for the service.- See Also:
- Constant Field Values
-
PROPERTY_SERVICE_MAX_THREAD_POOL_SIZE
public static final java.lang.String PROPERTY_SERVICE_MAX_THREAD_POOL_SIZE
- See Also:
- Constant Field Values
-
PROPERTY_SERVICE_MAX_CORE_POOL_SIZE
public static final java.lang.String PROPERTY_SERVICE_MAX_CORE_POOL_SIZE
Name ofPropertyfor the maximum number ofStreamBufferinstances cached in a core pool.- See Also:
- Constant Field Values
-
HANDLE_REQUEST_FLOW_NAME
public static final java.lang.String HANDLE_REQUEST_FLOW_NAME
Name of theFlowto handle the request.- See Also:
- Constant Field Values
-
SSL_TEAM_NAME
public static final java.lang.String SSL_TEAM_NAME
Name of theTeamto execute the SSL tasks.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
HttpServerSocketManagedObjectSource
public HttpServerSocketManagedObjectSource()
Default constructor to configure fromPropertyList.
-
HttpServerSocketManagedObjectSource
public HttpServerSocketManagedObjectSource(HttpServerLocation serverLocation, HttpHeaderValue serverName, DateHttpHeaderClock dateHttpHeaderClock, boolean isIncludeEscalationStackTrace)
Instantiate for non-secure servicing.- Parameters:
serverLocation-HttpServerLocation.serverName-ServerHttpHeaderValue.dateHttpHeaderClock-DateHttpHeaderClock.isIncludeEscalationStackTrace- Indicates if include theEscalationstack trace on theHttpResponse.
-
HttpServerSocketManagedObjectSource
public HttpServerSocketManagedObjectSource(HttpServerLocation serverLocation, HttpHeaderValue serverName, DateHttpHeaderClock dateHttpHeaderClock, boolean isIncludeEscalationStackTrace, javax.net.ssl.SSLContext sslContext)
Instantiate for secure servicing.- Parameters:
serverLocation-HttpServerLocation.serverName-ServerHttpHeaderValue.dateHttpHeaderClock-DateHttpHeaderClock.isIncludeEscalationStackTrace- Indicates if include theEscalationstack trace on theHttpResponse.sslContext-SSLContext. May benullif behind reverse proxy handling secure communication.
-
-
Method Detail
-
createSocketManager
public static SocketManager createSocketManager(java.util.concurrent.ThreadFactory[] executionStrategy) throws java.io.IOException
Creates theSocketManagerconfigured fromSystemproperties.- Parameters:
executionStrategy-ThreadFactoryinstances for theExecutionStrategyfor theSocketManager.- Returns:
SocketManagerconfigured fromSystemproperties.- Throws:
java.io.IOException- If fails to create theSocketManager.
-
isSocketManagerActive
public static boolean isSocketManagerActive()
Indicates if there is an activeSocketManagerforHttpServerSocketManagedObjectSourceinstances.- Returns:
trueif activeSocketManager.
-
getServerSocketDecorator
protected ServerSocketDecorator getServerSocketDecorator(AbstractAsyncManagedObjectSource.MetaDataContext<None,Indexed> context)
Enables overriding to configure aServerSocketDecorator.- Parameters:
context-AbstractAsyncManagedObjectSource.MetaDataContext.- Returns:
ServerSocketDecorator.
-
getAcceptedSocketDecorator
protected AcceptedSocketDecorator getAcceptedSocketDecorator(AbstractAsyncManagedObjectSource.MetaDataContext<None,Indexed> context)
Enables overriding to configure theAcceptedSocketDecorator.- Parameters:
context-AbstractAsyncManagedObjectSource.MetaDataContext.- Returns:
AcceptedSocketDecorator.
-
loadSpecification
protected void loadSpecification(AbstractAsyncManagedObjectSource.SpecificationContext context)
Description copied from class:AbstractAsyncManagedObjectSourceOverridden to load specifications.- Specified by:
loadSpecificationin classAbstractAsyncManagedObjectSource<None,Indexed>- Parameters:
context- Specifications.
-
loadMetaData
protected void loadMetaData(AbstractAsyncManagedObjectSource.MetaDataContext<None,Indexed> context) throws java.lang.Exception
Description copied from class:AbstractAsyncManagedObjectSourceOverridden to load meta-data.- Specified by:
loadMetaDatain classAbstractAsyncManagedObjectSource<None,Indexed>- Parameters:
context- Meta-data.- Throws:
java.lang.Exception- If fails to load the meta-data.
-
start
public void start(ManagedObjectExecuteContext<Indexed> context) throws java.lang.Exception
Description copied from interface:ManagedObjectSourceCalled once after
ManagedObjectSource.init(ManagedObjectSourceContext)to indicate thisManagedObjectSourceshould start execution.On invocation of this method,
ProcessStateinstances may be invoked via theManagedObjectExecuteContext.- Specified by:
startin interfaceManagedObjectSource<None,Indexed>- Overrides:
startin classAbstractAsyncManagedObjectSource<None,Indexed>- Parameters:
context-ManagedObjectExecuteContextto use in starting thisManagedObjectSource.- Throws:
java.lang.Exception- Should theManagedObjectSourcefail to start execution.
-
getManagedObject
protected ManagedObject getManagedObject() throws java.lang.Throwable
Description copied from class:AbstractManagedObjectSourceSynchronously obtains theManagedObject.- Specified by:
getManagedObjectin classAbstractManagedObjectSource<None,Indexed>- Returns:
ManagedObject.- Throws:
java.lang.Throwable- If fails to obtain theManagedObject.
-
execute
public void execute(ManagedFunctionContext<Indexed,None> context) throws java.lang.Throwable
Description copied from interface:ManagedFunctionExecutes the function.- Specified by:
executein interfaceManagedFunction<Indexed,None>- Parameters:
context-ManagedFunctionContextfor theManagedFunction.- Throws:
java.lang.Throwable- Indicating failure of theManagedFunction.
-
-