Interface WebArchitect
-
- All Known Implementing Classes:
WebArchitectEmployer
public interface WebArchitect
Web configuration extensions for theOfficeArchitect
.- Author:
- Daniel Sagenschneider
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
HANDLER_INPUT_NAME
Name of theOfficeSectionInput
that handles theHttpRequest
instances.static java.lang.String
HANDLER_SECTION_NAME
Name of theOfficeSection
that handles theHttpRequest
instances.
-
Method Summary
All Methods Instance Methods Abstract 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
.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
-
HANDLER_SECTION_NAME
static final java.lang.String HANDLER_SECTION_NAME
Name of theOfficeSection
that handles theHttpRequest
instances.- See Also:
- Constant Field Values
-
HANDLER_INPUT_NAME
static final java.lang.String HANDLER_INPUT_NAME
Name of theOfficeSectionInput
that handles theHttpRequest
instances.- See Also:
- Constant Field Values
-
-
Method Detail
-
addHttpObjectParser
void addHttpObjectParser(HttpObjectParserFactory objectParserFactory)
Manually adds a
HttpObjectParserFactory
.Typically these should be configured via
HttpObjectParserServiceFactory
, so can be plugged in as required.- Parameters:
objectParserFactory
-HttpObjectParserFactory
.
-
setDefaultHttpObjectParser
void setDefaultHttpObjectParser(HttpObjectParserServiceFactory objectParserServiceFactory)
Specifies the defaultHttpObjectParserServiceFactory
.- Parameters:
objectParserServiceFactory
- DefaultHttpObjectParserServiceFactory
.
-
addHttpObjectAnnotationAlias
void addHttpObjectAnnotationAlias(java.lang.Class<?> httpObjectAnnotationAliasClass, java.lang.String... acceptedContentTypes)
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.- 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.
-
addHttpObjectResponder
void addHttpObjectResponder(HttpObjectResponderFactory objectResponderFactory)
Adds aHttpObjectResponderFactory
.- Parameters:
objectResponderFactory
-HttpObjectResponderFactory
.
-
setDefaultHttpObjectResponder
void setDefaultHttpObjectResponder(HttpObjectResponderServiceFactory objectResponderServiceFactory)
Specifies the defaultHttpObjectResponderServiceFactory
.- Parameters:
objectResponderServiceFactory
- DefaultHttpObjectResponderServiceFactory
.
-
addHttpApplicationObject
OfficeManagedObject addHttpApplicationObject(java.lang.Class<?> objectClass, java.lang.String bindName)
Adds an object to be lazily created and stored within theHttpApplicationState
.- Parameters:
objectClass
- Class of the object.bindName
- Name to bind the object within theHttpApplicationState
.- Returns:
OfficeManagedObject
.
-
addHttpApplicationObject
OfficeManagedObject addHttpApplicationObject(java.lang.Class<?> objectClass)
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.
- Parameters:
objectClass
- Class of the object.- Returns:
OfficeManagedObject
.
-
addHttpSessionObject
OfficeManagedObject addHttpSessionObject(java.lang.Class<?> objectClass, java.lang.String bindName)
Adds an object to be lazily created and stored within theHttpSession
.- Parameters:
objectClass
- Class of the object.bindName
- Name to bind the object within theHttpSession
.- Returns:
OfficeManagedObject
.
-
addHttpSessionObject
OfficeManagedObject addHttpSessionObject(java.lang.Class<?> objectClass)
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.
- Parameters:
objectClass
- Class of the object.- Returns:
OfficeManagedObject
.
-
addHttpRequestObject
OfficeManagedObject addHttpRequestObject(java.lang.Class<?> objectClass, boolean isLoadParameters, java.lang.String bindName)
Adds an object to be lazily created and stored within theHttpRequestState
.- 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
OfficeManagedObject addHttpRequestObject(java.lang.Class<?> objectClass, boolean isLoadParameters)
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.
- Parameters:
objectClass
- Class of the object.isLoadParameters
- Indicates whether to load the HTTP parameters to instantiated objects.- Returns:
OfficeManagedObject
.
-
addHttpArgument
OfficeManagedObject addHttpArgument(java.lang.String parameterName, HttpValueLocation location)
Adds a HTTP argument.- Parameters:
parameterName
- Name of the parameter.location
-HttpValueLocation
to obtain the argument value. May benull
to obtain from anywhere on theHttpRequest
.- Returns:
OfficeManagedObject
.
-
addHttpObject
OfficeManagedObject addHttpObject(java.lang.Class<?> objectClass, java.lang.String... acceptedContentTypes)
Adds a HTTPObject
to be parsed from theHttpRequest
.- 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
.
-
isPathParameters
boolean isPathParameters(java.lang.String path)
Indicates if the path contains path parameters.- Parameters:
path
- Path.- Returns:
true
if path contains parameters.
-
getHttpInput
HttpUrlContinuation getHttpInput(boolean isSecure, java.lang.String applicationPath)
Creates aHttpUrlContinuation
into the web application. This will always be aHttpMethod.GET
due to redirection required for theHttpUrlContinuation
.- Parameters:
isSecure
- Indicates if secure connection required.applicationPath
- Application path to be linked.- Returns:
HttpUrlContinuation
.
-
getHttpInput
HttpInput getHttpInput(boolean isSecure, java.lang.String httpMethodName, java.lang.String applicationPath)
Creates aHttpInput
into the application.- Parameters:
isSecure
- Indicates if secure connection required.httpMethodName
- Name of theHttpMethod
.applicationPath
- URL path of the application to be linked.- Returns:
HttpInput
.
-
addHttpInputExplorer
void addHttpInputExplorer(HttpInputExplorer explorer)
Adds aHttpInputExplorer
.- Parameters:
explorer
-HttpInputExplorer
.
-
reroute
void reroute(OfficeFlowSourceNode flowSourceNode)
Runs the
ServerHttpConnection
through routing again.Typically, this is used on importing previous state into the
ServerHttpConnection
and then have it serviced.- Parameters:
flowSourceNode
-OfficeFlowSourceNode
to trigger re-routing theServerHttpConnection
.
-
intercept
void intercept(OfficeFlowSinkNode flowSinkNode, OfficeFlowSourceNode flowSourceNode)
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.
- Parameters:
flowSinkNode
-OfficeFlowSinkNode
to handle intercepting theHttpRequest
.flowSourceNode
-OfficeFlowSourceNode
to continue servicing theHttpRequest
.
-
chainServicer
void chainServicer(OfficeFlowSinkNode flowSinkNode, OfficeFlowSourceNode notHandledOutput)
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.- 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
<H> AcceptNegotiatorBuilder<H> createAcceptNegotiator()
Creates theAcceptNegotiatorBuilder
to build anAcceptNegotiator
.- Type Parameters:
H
- Handler type.- Returns:
AcceptNegotiatorBuilder
to build anAcceptNegotiator
.
-
informOfficeArchitect
void informOfficeArchitect()
Informs theOfficeArchitect
of the web architect. This is to be invoked once all web architecture is configured.
-
-