Class AbstractWebTemplate
- java.lang.Object
-
- net.officefloor.web.template.build.AbstractWebTemplate
-
- All Implemented Interfaces:
PropertyConfigurable
,WebTemplate
public abstract class AbstractWebTemplate extends java.lang.Object implements WebTemplate
AbstractWebTemplate
.- Author:
- Daniel Sagenschneider
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String
applicationPath
Application path for theWebTemplate
.protected java.lang.String
charsetName
Name of theCharset
.protected java.lang.String
contentType
Content-Type
for theWebTemplate
.protected boolean
isSecure
Indicates if theWebTemplate
is secure.protected char
linkSeparatorCharacter
Link separator character.protected java.lang.String
logicClassName
Name of the logicClass
for theWebTemplate
.protected java.lang.String
redirectValuesFunctionName
Name ofMethod
on the logicClass
to return the values for path parameters in redirecting to thisWebTemplate
.protected java.util.List<java.lang.String>
renderHttpMethodNames
RenderHttpMethod
names.protected java.util.Map<java.lang.String,java.lang.Boolean>
secureLinks
Secure links.protected AbstractWebTemplate
superTemplate
SuperWebTemplate
.protected WebTemplateSectionSource
webTemplateSectionSource
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractWebTemplate(WebTemplateSectionSource webTemplateSectionSource, boolean isSecure, java.lang.String applicationPath, PropertyList properties, SourceIssues sourceIssues)
Instantiate.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description WebTemplateExtensionBuilder
addExtension(java.lang.String webTemplateExtensionClassName)
Adds aWebTemplateExtension
for thisWebTemplate
.void
addProperty(java.lang.String name, java.lang.String value)
Adds aProperty
to configure the item.WebTemplate
addRenderHttpMethod(java.lang.String httpMethodName)
Adds aHttpMethod
that will render theWebTemplate
.protected abstract PropertyList
createPropertyList()
Creates a newPropertyList
.java.lang.String
getApplicationPath()
Obtains the application path.HttpSecurableBuilder
getHttpSecurer()
Obtains theHttpSecurableBuilder
to configure access controls to thisWebTemplate
.WebTemplateSectionSource
getWebTemplateSectionSource()
Obtains theWebTemplateSectionSource
.PropertyList
loadProperties(boolean isPathParameters)
Loads the properties.WebTemplate
setCharset(java.lang.String charsetName)
Allow overriding the defaultCharset
to render theWebTemplate
.WebTemplate
setContentType(java.lang.String contentType)
Specifies theContent-Type
output by thisWebTemplate
.WebTemplate
setLinkSecure(java.lang.String linkName, boolean isSecure)
Indicate whether a secure connection is required for the link.WebTemplate
setLinkSeparatorCharacter(char separator)
Allows overriding the default separator character between the path and link.WebTemplate
setLogicClass(java.lang.String logicClassName)
Specifies the logicClass
.WebTemplate
setRedirectValuesFunction(java.lang.String functionName)
Specifies theMethod
name on the logicClass
to provide the values for redirect path parameters to thisWebTemplate
.WebTemplate
setSuperTemplate(WebTemplate superTemplate)
Specifies the super (parent)WebTemplate
.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.officefloor.web.template.build.WebTemplate
addGovernance, getOutput, getRender
-
-
-
-
Field Detail
-
webTemplateSectionSource
protected final WebTemplateSectionSource webTemplateSectionSource
-
isSecure
protected final boolean isSecure
Indicates if theWebTemplate
is secure.
-
applicationPath
protected final java.lang.String applicationPath
Application path for theWebTemplate
.
-
logicClassName
protected java.lang.String logicClassName
Name of the logicClass
for theWebTemplate
.
-
redirectValuesFunctionName
protected java.lang.String redirectValuesFunctionName
Name ofMethod
on the logicClass
to return the values for path parameters in redirecting to thisWebTemplate
.
-
secureLinks
protected java.util.Map<java.lang.String,java.lang.Boolean> secureLinks
Secure links.
-
linkSeparatorCharacter
protected char linkSeparatorCharacter
Link separator character.
-
contentType
protected java.lang.String contentType
Content-Type
for theWebTemplate
.
-
charsetName
protected java.lang.String charsetName
Name of theCharset
.
-
renderHttpMethodNames
protected final java.util.List<java.lang.String> renderHttpMethodNames
RenderHttpMethod
names.
-
superTemplate
protected AbstractWebTemplate superTemplate
SuperWebTemplate
.
-
-
Constructor Detail
-
AbstractWebTemplate
protected AbstractWebTemplate(WebTemplateSectionSource webTemplateSectionSource, boolean isSecure, java.lang.String applicationPath, PropertyList properties, SourceIssues sourceIssues)
Instantiate.- Parameters:
webTemplateSectionSource
-WebTemplateSectionSource
instance to use.isSecure
- Indicates if requires secureServerHttpConnection
to render theWebTemplate
.applicationPath
- Application path for theWebTemplate
.properties
-PropertyList
.sourceIssues
-SourceIssues
.
-
-
Method Detail
-
createPropertyList
protected abstract PropertyList createPropertyList()
Creates a newPropertyList
.- Returns:
- New
PropertyList
.
-
getApplicationPath
public java.lang.String getApplicationPath()
Obtains the application path.- Returns:
- Application path.
-
getWebTemplateSectionSource
public WebTemplateSectionSource getWebTemplateSectionSource()
Obtains theWebTemplateSectionSource
.- Returns:
WebTemplateSectionSource
.
-
loadProperties
public PropertyList loadProperties(boolean isPathParameters)
Loads the properties.- Parameters:
isPathParameters
- Indicates if path parameters.- Returns:
PropertyList
.
-
addProperty
public void addProperty(java.lang.String name, java.lang.String value)
Description copied from interface:PropertyConfigurable
Adds aProperty
to configure the item.- Specified by:
addProperty
in interfacePropertyConfigurable
- Parameters:
name
- Name ofProperty
.value
- Value ofProperty
.
-
setLogicClass
public WebTemplate setLogicClass(java.lang.String logicClassName)
Description copied from interface:WebTemplate
Specifies the logicClass
.- Specified by:
setLogicClass
in interfaceWebTemplate
- Parameters:
logicClassName
- Name of the logicClass
.- Returns:
this
.
-
setRedirectValuesFunction
public WebTemplate setRedirectValuesFunction(java.lang.String functionName)
Description copied from interface:WebTemplate
Specifies the
Method
name on the logicClass
to provide the values for redirect path parameters to thisWebTemplate
. The returned type from theMethod
will be used to source values for parameters in constructing the path to thisWebTemplate
.Should the path to the template be static (i.e. has no path parameters), no
Method
need be specified.- Specified by:
setRedirectValuesFunction
in interfaceWebTemplate
- Parameters:
functionName
- LogicClass
Method
name.- Returns:
this
.
-
setContentType
public WebTemplate setContentType(java.lang.String contentType)
Description copied from interface:WebTemplate
Specifies theContent-Type
output by thisWebTemplate
.- Specified by:
setContentType
in interfaceWebTemplate
- Parameters:
contentType
-Content-Type
output by thisWebTemplate
.- Returns:
this
.
-
setCharset
public WebTemplate setCharset(java.lang.String charsetName)
Description copied from interface:WebTemplate
Allow overriding the defaultCharset
to render theWebTemplate
.- Specified by:
setCharset
in interfaceWebTemplate
- Parameters:
charsetName
- Name ofCharset
to render theWebTemplate
.- Returns:
this
.
-
setLinkSeparatorCharacter
public WebTemplate setLinkSeparatorCharacter(char separator)
Description copied from interface:WebTemplate
Allows overriding the default separator character between the path and link.- Specified by:
setLinkSeparatorCharacter
in interfaceWebTemplate
- Parameters:
separator
- Separator to use to separate path and link.- Returns:
this
.
-
setLinkSecure
public WebTemplate setLinkSecure(java.lang.String linkName, boolean isSecure)
Description copied from interface:WebTemplate
Indicate whether a secure connection is required for the link. This overrides the default template secure setting for the link.
Example use could be the landing page may be insecure but the login form submission link on the page is to be secure.
- Specified by:
setLinkSecure
in interfaceWebTemplate
- Parameters:
linkName
- Name of link to secure.isSecure
-true
should the link require a secureServerHttpConnection
.- Returns:
this
.
-
getHttpSecurer
public HttpSecurableBuilder getHttpSecurer()
Description copied from interface:WebTemplate
Obtains the
HttpSecurableBuilder
to configure access controls to thisWebTemplate
.Calling this method without providing configuration requires only authentication to access the
WebTemplate
.- Specified by:
getHttpSecurer
in interfaceWebTemplate
- Returns:
HttpSecurableBuilder
.
-
addRenderHttpMethod
public WebTemplate addRenderHttpMethod(java.lang.String httpMethodName)
Description copied from interface:WebTemplate
Adds a
HttpMethod
that will render theWebTemplate
. Should theHttpMethod
not be in this list, a redirect will occur toHttpMethod.HttpMethodEnum.GET
.Note that
HttpMethod.HttpMethodEnum.GET
is added by default.- Specified by:
addRenderHttpMethod
in interfaceWebTemplate
- Parameters:
httpMethodName
- Name of theHttpMethod
that will render theWebTemplate
.- Returns:
this
.
-
setSuperTemplate
public WebTemplate setSuperTemplate(WebTemplate superTemplate)
Description copied from interface:WebTemplate
Specifies the super (parent)WebTemplate
.- Specified by:
setSuperTemplate
in interfaceWebTemplate
- Parameters:
superTemplate
- SuperWebTemplate
.- Returns:
this
.
-
addExtension
public WebTemplateExtensionBuilder addExtension(java.lang.String webTemplateExtensionClassName)
Description copied from interface:WebTemplate
Adds aWebTemplateExtension
for thisWebTemplate
.- Specified by:
addExtension
in interfaceWebTemplate
- Parameters:
webTemplateExtensionClassName
-WebTemplateExtension
Class
name.- Returns:
WebTemplateExtensionBuilder
to build theWebTemplateExtension
.
-
-