Class WebArchitectEmployer
- java.lang.Object
-
- net.officefloor.web.WebArchitectEmployer
-
- All Implemented Interfaces:
WebArchitect
public class WebArchitectEmployer extends java.lang.Object implements WebArchitect
WebArchitect
implementation.- Author:
- Daniel Sagenschneider
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
PROPERTY_CONTEXT_PATH
Name ofProperty
specifying the context path.-
Fields inherited from interface net.officefloor.web.build.WebArchitect
HANDLER_INPUT_NAME, HANDLER_SECTION_NAME
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description OfficeManagedObject
addHttpApplicationObject(java.lang.Class<?> objectClass)
Adds an object to be lazily created and stored within theHttpApplicationState
.OfficeManagedObject
addHttpApplicationObject(java.lang.Class<?> objectClass, java.lang.String bindName)
Adds an object to be lazily created and stored within theHttpApplicationState
.OfficeManagedObject
addHttpArgument(java.lang.String parameterName, HttpValueLocation location)
Adds a HTTP argument.void
addHttpInputExplorer(HttpInputExplorer explorer)
Adds aHttpInputExplorer
.OfficeManagedObject
addHttpObject(java.lang.Class<?> objectClass, java.lang.String... acceptedContentTypes)
Adds a HTTPObject
to be parsed from theHttpRequest
.void
addHttpObjectAnnotationAlias(java.lang.Class<?> httpObjectAnnotationAliasClass, java.lang.String... acceptedContentTypes)
Adds anotherClass
as an alias for theHttpObject
annotation.void
addHttpObjectParser(HttpObjectParserFactory objectParserFactory)
Manually adds aHttpObjectParserFactory
.void
addHttpObjectResponder(HttpObjectResponderFactory objectResponderFactory)
Adds aHttpObjectResponderFactory
.OfficeManagedObject
addHttpRequestObject(java.lang.Class<?> objectClass, boolean isLoadParameters)
Adds an object to be lazily created and stored within theHttpRequestState
.OfficeManagedObject
addHttpRequestObject(java.lang.Class<?> objectClass, boolean isLoadParameters, java.lang.String bindName)
Adds an object to be lazily created and stored within theHttpRequestState
.OfficeManagedObject
addHttpSessionObject(java.lang.Class<?> objectClass)
Adds an object to be lazily created and stored within theHttpSession
.OfficeManagedObject
addHttpSessionObject(java.lang.Class<?> objectClass, java.lang.String bindName)
Adds an object to be lazily created and stored within theHttpSession
.void
chainServicer(OfficeFlowSinkNode flowSinkNode, OfficeFlowSourceNode notHandledOutput)
Chains aOfficeSectionInput
to the end of the servicing chain to handle aHttpRequest
.<H> AcceptNegotiatorBuilder<H>
createAcceptNegotiator()
Creates theAcceptNegotiatorBuilder
to build anAcceptNegotiator
.static WebArchitect
employWebArchitect(java.lang.String contextPath, OfficeArchitect officeArchitect, OfficeSourceContext officeSourceContext)
Employs aWebArchitect
.static WebArchitect
employWebArchitect(OfficeArchitect officeArchitect, OfficeSourceContext officeSourceContext)
Employs aWebArchitect
.HttpUrlContinuation
getHttpInput(boolean isSecure, java.lang.String applicationPath)
Creates aHttpUrlContinuation
into the web application.HttpInput
getHttpInput(boolean isSecure, java.lang.String httpMethodName, java.lang.String applicationPath)
Creates aHttpInput
into the application.void
informOfficeArchitect()
Informs theOfficeArchitect
of the web architect.void
intercept(OfficeFlowSinkNode flowSinkNode, OfficeFlowSourceNode flowSourceNode)
Intercepts allHttpRequest
instances before servicing.boolean
isPathParameters(java.lang.String path)
Indicates if the path contains path parameters.void
reroute(OfficeFlowSourceNode flowSourceNode)
Runs theServerHttpConnection
through routing again.void
setDefaultHttpObjectParser(HttpObjectParserServiceFactory objectParserServiceFactory)
Specifies the defaultHttpObjectParserServiceFactory
.void
setDefaultHttpObjectResponder(HttpObjectResponderServiceFactory objectResponderServiceFactory)
Specifies the defaultHttpObjectResponderServiceFactory
.
-
-
-
Field Detail
-
PROPERTY_CONTEXT_PATH
public static final java.lang.String PROPERTY_CONTEXT_PATH
Name ofProperty
specifying the context path.- See Also:
- Constant Field Values
-
-
Method Detail
-
employWebArchitect
public static WebArchitect employWebArchitect(OfficeArchitect officeArchitect, OfficeSourceContext officeSourceContext)
Employs aWebArchitect
.- Parameters:
officeArchitect
-OfficeArchitect
.officeSourceContext
-OfficeSourceContext
used to sourceProperty
values to configure theWebArchitect
.- Returns:
WebArchitect
.
-
employWebArchitect
public static WebArchitect employWebArchitect(java.lang.String contextPath, OfficeArchitect officeArchitect, OfficeSourceContext officeSourceContext)
Employs aWebArchitect
.- Parameters:
contextPath
- Context path for the web application. May benull
for no context path.officeArchitect
-OfficeArchitect
.officeSourceContext
-OfficeSourceContext
used to sourceProperty
values to configure theWebArchitect
.- Returns:
WebArchitect
.
-
addHttpArgument
public OfficeManagedObject addHttpArgument(java.lang.String parameterName, HttpValueLocation location)
Description copied from interface:WebArchitect
Adds a HTTP argument.- Specified by:
addHttpArgument
in interfaceWebArchitect
- Parameters:
parameterName
- Name of the parameter.location
-HttpValueLocation
to obtain the argument value. May benull
to obtain from anywhere on theHttpRequest
.- Returns:
OfficeManagedObject
.
-
addHttpApplicationObject
public OfficeManagedObject addHttpApplicationObject(java.lang.Class<?> objectClass, java.lang.String bindName)
Description copied from interface:WebArchitect
Adds an object to be lazily created and stored within theHttpApplicationState
.- Specified by:
addHttpApplicationObject
in interfaceWebArchitect
- Parameters:
objectClass
- Class of the object.bindName
- Name to bind the object within theHttpApplicationState
.- Returns:
OfficeManagedObject
.
-
addHttpApplicationObject
public OfficeManagedObject addHttpApplicationObject(java.lang.Class<?> objectClass)
Description copied from interface:WebArchitect
Adds an object to be lazily created and stored within the
HttpApplicationState
.The bound name is arbitrarily chosen but will be unique for the object.
- Specified by:
addHttpApplicationObject
in interfaceWebArchitect
- Parameters:
objectClass
- Class of the object.- Returns:
OfficeManagedObject
.
-
addHttpSessionObject
public OfficeManagedObject addHttpSessionObject(java.lang.Class<?> objectClass, java.lang.String bindName)
Description copied from interface:WebArchitect
Adds an object to be lazily created and stored within theHttpSession
.- Specified by:
addHttpSessionObject
in interfaceWebArchitect
- Parameters:
objectClass
- Class of the object.bindName
- Name to bind the object within theHttpSession
.- Returns:
OfficeManagedObject
.
-
addHttpSessionObject
public OfficeManagedObject addHttpSessionObject(java.lang.Class<?> objectClass)
Description copied from interface:WebArchitect
Adds an object to be lazily created and stored within the
HttpSession
.The bound name is arbitrarily chosen but will be unique for the object.
- Specified by:
addHttpSessionObject
in interfaceWebArchitect
- Parameters:
objectClass
- Class of the object.- Returns:
OfficeManagedObject
.
-
addHttpRequestObject
public OfficeManagedObject addHttpRequestObject(java.lang.Class<?> objectClass, boolean isLoadParameters, java.lang.String bindName)
Description copied from interface:WebArchitect
Adds an object to be lazily created and stored within theHttpRequestState
.- Specified by:
addHttpRequestObject
in interfaceWebArchitect
- Parameters:
objectClass
- Class of the object.isLoadParameters
- Indicates whether to load the HTTP parameters to instantiated objects.bindName
- Name to bind the object within theHttpRequestState
.- Returns:
OfficeManagedObject
.
-
addHttpRequestObject
public OfficeManagedObject addHttpRequestObject(java.lang.Class<?> objectClass, boolean isLoadParameters)
Description copied from interface:WebArchitect
Adds an object to be lazily created and stored within the
HttpRequestState
.The bound name is arbitrarily chosen but will be unique for the object.
- Specified by:
addHttpRequestObject
in interfaceWebArchitect
- Parameters:
objectClass
- Class of the object.isLoadParameters
- Indicates whether to load the HTTP parameters to instantiated objects.- Returns:
OfficeManagedObject
.
-
addHttpObjectParser
public void addHttpObjectParser(HttpObjectParserFactory objectParserFactory)
Description copied from interface:WebArchitect
Manually adds a
HttpObjectParserFactory
.Typically these should be configured via
HttpObjectParserServiceFactory
, so can be plugged in as required.- Specified by:
addHttpObjectParser
in interfaceWebArchitect
- Parameters:
objectParserFactory
-HttpObjectParserFactory
.
-
setDefaultHttpObjectParser
public void setDefaultHttpObjectParser(HttpObjectParserServiceFactory objectParserServiceFactory)
Description copied from interface:WebArchitect
Specifies the defaultHttpObjectParserServiceFactory
.- Specified by:
setDefaultHttpObjectParser
in interfaceWebArchitect
- Parameters:
objectParserServiceFactory
- DefaultHttpObjectParserServiceFactory
.
-
addHttpObjectAnnotationAlias
public void addHttpObjectAnnotationAlias(java.lang.Class<?> httpObjectAnnotationAliasClass, java.lang.String... acceptedContentTypes)
Description copied from interface:WebArchitect
Adds another
Class
as an alias for theHttpObject
annotation.As code generators are likely to be used for the HTTP objects, it is not always possible to generate the
Class
annotated withHttpObject
. This allows anotherAnnotation
to indicate the parameter object is a HTTP object.- Specified by:
addHttpObjectAnnotationAlias
in interfaceWebArchitect
- Parameters:
httpObjectAnnotationAliasClass
- AliasAnnotation
Class
forHttpObject
.acceptedContentTypes
- Listing of thecontent-type
values accepted. May be empty array to allow supporting all availablecontent-type
HttpObjectParser
instances available.
-
addHttpObject
public OfficeManagedObject addHttpObject(java.lang.Class<?> objectClass, java.lang.String... acceptedContentTypes)
Description copied from interface:WebArchitect
Adds a HTTPObject
to be parsed from theHttpRequest
.- Specified by:
addHttpObject
in interfaceWebArchitect
- Parameters:
objectClass
- Class of the object.acceptedContentTypes
- Listing of thecontent-type
values accepted. May be empty array to allow supporting all availablecontent-type
HttpObjectParser
instances available.- Returns:
OfficeManagedObject
.
-
addHttpObjectResponder
public void addHttpObjectResponder(HttpObjectResponderFactory objectResponderFactory)
Description copied from interface:WebArchitect
Adds aHttpObjectResponderFactory
.- Specified by:
addHttpObjectResponder
in interfaceWebArchitect
- Parameters:
objectResponderFactory
-HttpObjectResponderFactory
.
-
setDefaultHttpObjectResponder
public void setDefaultHttpObjectResponder(HttpObjectResponderServiceFactory objectResponderServiceFactory)
Description copied from interface:WebArchitect
Specifies the defaultHttpObjectResponderServiceFactory
.- Specified by:
setDefaultHttpObjectResponder
in interfaceWebArchitect
- Parameters:
objectResponderServiceFactory
- DefaultHttpObjectResponderServiceFactory
.
-
isPathParameters
public boolean isPathParameters(java.lang.String path)
Description copied from interface:WebArchitect
Indicates if the path contains path parameters.- Specified by:
isPathParameters
in interfaceWebArchitect
- Parameters:
path
- Path.- Returns:
true
if path contains parameters.
-
getHttpInput
public HttpUrlContinuation getHttpInput(boolean isSecure, java.lang.String applicationPath)
Description copied from interface:WebArchitect
Creates aHttpUrlContinuation
into the web application. This will always be aHttpMethod.GET
due to redirection required for theHttpUrlContinuation
.- Specified by:
getHttpInput
in interfaceWebArchitect
- Parameters:
isSecure
- Indicates if secure connection required.applicationPath
- Application path to be linked.- Returns:
HttpUrlContinuation
.
-
getHttpInput
public HttpInput getHttpInput(boolean isSecure, java.lang.String httpMethodName, java.lang.String applicationPath)
Description copied from interface:WebArchitect
Creates aHttpInput
into the application.- Specified by:
getHttpInput
in interfaceWebArchitect
- Parameters:
isSecure
- Indicates if secure connection required.httpMethodName
- Name of theHttpMethod
.applicationPath
- URL path of the application to be linked.- Returns:
HttpInput
.
-
addHttpInputExplorer
public void addHttpInputExplorer(HttpInputExplorer explorer)
Description copied from interface:WebArchitect
Adds aHttpInputExplorer
.- Specified by:
addHttpInputExplorer
in interfaceWebArchitect
- Parameters:
explorer
-HttpInputExplorer
.
-
reroute
public void reroute(OfficeFlowSourceNode flowSourceNode)
Description copied from interface:WebArchitect
Runs the
ServerHttpConnection
through routing again.Typically, this is used on importing previous state into the
ServerHttpConnection
and then have it serviced.- Specified by:
reroute
in interfaceWebArchitect
- Parameters:
flowSourceNode
-OfficeFlowSourceNode
to trigger re-routing theServerHttpConnection
.
-
intercept
public void intercept(OfficeFlowSinkNode flowSinkNode, OfficeFlowSourceNode flowSourceNode)
Description copied from interface:WebArchitect
Intercepts all
HttpRequest
instances before servicing. Multiple intercepts may be configured, with them executed in the order they are added.This allows, for example, logging all requests to the web application.
- Specified by:
intercept
in interfaceWebArchitect
- Parameters:
flowSinkNode
-OfficeFlowSinkNode
to handle intercepting theHttpRequest
.flowSourceNode
-OfficeFlowSourceNode
to continue servicing theHttpRequest
.
-
chainServicer
public void chainServicer(OfficeFlowSinkNode flowSinkNode, OfficeFlowSourceNode notHandledOutput)
Description copied from interface:WebArchitect
Chains a
OfficeSectionInput
to the end of the servicing chain to handle aHttpRequest
. Multiple chained services may be added, with them executed in the order they are added.The
WebArchitect
functionality is always the first in the chain to attempt to service theHttpRequest
. This allows, for example, adding a chained servicer for serving resources from a file system.- Specified by:
chainServicer
in interfaceWebArchitect
- Parameters:
flowSinkNode
-OfficeFlowSinkNode
to handle theHttpRequest
.notHandledOutput
-OfficeFlowSourceNode
should this servicer not handle theHttpRequest
. May benull
if handles allHttpRequest
instances (any services chained after this will therefore not be used).
-
createAcceptNegotiator
public <H> AcceptNegotiatorBuilder<H> createAcceptNegotiator()
Description copied from interface:WebArchitect
Creates theAcceptNegotiatorBuilder
to build anAcceptNegotiator
.- Specified by:
createAcceptNegotiator
in interfaceWebArchitect
- Type Parameters:
H
- Handler type.- Returns:
AcceptNegotiatorBuilder
to build anAcceptNegotiator
.
-
informOfficeArchitect
public void informOfficeArchitect()
Description copied from interface:WebArchitect
Informs theOfficeArchitect
of the web architect. This is to be invoked once all web architecture is configured.- Specified by:
informOfficeArchitect
in interfaceWebArchitect
-
-