![JAR search and dependency download from the Maven repository](/logo.png)
net.officefloor.web.template.build.WebTemplate Maven / Gradle / Ivy
/*-
* #%L
* Web Template
* %%
* Copyright (C) 2005 - 2020 Daniel Sagenschneider
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
* #L%
*/
package net.officefloor.web.template.build;
import java.lang.reflect.Method;
import java.nio.charset.Charset;
import net.officefloor.compile.properties.PropertyConfigurable;
import net.officefloor.compile.spi.office.OfficeFlowSinkNode;
import net.officefloor.compile.spi.office.OfficeFlowSourceNode;
import net.officefloor.compile.spi.office.OfficeGovernance;
import net.officefloor.compile.spi.office.OfficeSectionFunction;
import net.officefloor.compile.spi.office.OfficeSubSection;
import net.officefloor.frame.api.governance.Governance;
import net.officefloor.server.http.HttpMethod;
import net.officefloor.server.http.HttpMethod.HttpMethodEnum;
import net.officefloor.server.http.ServerHttpConnection;
import net.officefloor.web.security.build.HttpSecurableBuilder;
import net.officefloor.web.template.extension.WebTemplateExtension;
/**
* Web template.
*
* @author Daniel Sagenschneider
*/
public interface WebTemplate extends PropertyConfigurable {
/**
* Specifies the logic {@link Class}.
*
* @param logicClassName
* Name of the logic {@link Class}.
* @return this
.
*/
WebTemplate setLogicClass(String logicClassName);
/**
*
* Specifies the {@link Method} name on the logic {@link Class} to provide the
* values for redirect path parameters to this {@link WebTemplate}. The returned
* type from the {@link Method} will be used to source values for parameters in
* constructing the path to this {@link WebTemplate}.
*
* Should the path to the template be static (i.e. has no path parameters), no
* {@link Method} need be specified.
*
* @param functionName
* Logic {@link Class} {@link Method} name.
* @return this
.
*/
WebTemplate setRedirectValuesFunction(String functionName);
/**
* Specifies the Content-Type
output by this {@link WebTemplate}.
*
* @param contentType
* Content-Type
output by this {@link WebTemplate}.
* @return this
.
*/
WebTemplate setContentType(String contentType);
/**
* Allow overriding the default {@link Charset} to render the
* {@link WebTemplate}.
*
* @param charsetName
* Name of {@link Charset} to render the {@link WebTemplate}.
* @return this
.
*/
WebTemplate setCharset(String charsetName);
/**
* Allows overriding the default separator character between the path and link.
*
* @param separator
* Separator to use to separate path and link.
* @return this
.
*/
WebTemplate setLinkSeparatorCharacter(char separator);
/**
*
* 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.
*
* @param linkName
* Name of link to secure.
* @param isSecure
* true
should the link require a secure
* {@link ServerHttpConnection}.
* @return this
.
*/
WebTemplate setLinkSecure(String linkName, boolean isSecure);
/**
*
* Obtains the {@link HttpSecurableBuilder} to configure access controls to this
* {@link WebTemplate}.
*
* Calling this method without providing configuration requires only
* authentication to access the {@link WebTemplate}.
*
* @return {@link HttpSecurableBuilder}.
*/
HttpSecurableBuilder getHttpSecurer();
/**
*
* Adds a {@link HttpMethod} that will render the {@link WebTemplate}. Should
* the {@link HttpMethod} not be in this list, a redirect will occur to
* {@link HttpMethodEnum#GET}.
*
* Note that {@link HttpMethodEnum#GET} is added by default.
*
* @param httpMethodName
* Name of the {@link HttpMethod} that will render the
* {@link WebTemplate}.
* @return this
.
*/
WebTemplate addRenderHttpMethod(String httpMethodName);
/**
* Specifies the super (parent) {@link WebTemplate}.
*
* @param superTemplate
* Super {@link WebTemplate}.
* @return this
.
*/
WebTemplate setSuperTemplate(WebTemplate superTemplate);
/**
* Adds a {@link WebTemplateExtension} for this {@link WebTemplate}.
*
* @param webTemplateExtensionClassName
* {@link WebTemplateExtension} {@link Class} name.
* @return {@link WebTemplateExtensionBuilder} to build the
* {@link WebTemplateExtension}.
*/
WebTemplateExtensionBuilder addExtension(String webTemplateExtensionClassName);
/**
* Obtains the {@link OfficeFlowSinkNode} to render the {@link WebTemplate}.
*
* @param valuesTypeName
* Name of type provided as a parameter to the
* {@link OfficeFlowSinkNode} should the path parameters require
* being obtained. The type should provide a bean property for each
* path parameter for the {@link WebTemplate}. May be
* null
if no path parameters are required.
* @return {@link OfficeFlowSinkNode} to render the {@link WebTemplate}.
*/
OfficeFlowSinkNode getRender(String valuesTypeName);
/**
* Obtains the {@link OfficeFlowSourceNode} from the {@link WebTemplate}.
*
* @param outputName
* {@link OfficeFlowSourceNode} name.
* @return {@link OfficeFlowSourceNode} for the name.
*/
OfficeFlowSourceNode getOutput(String outputName);
/**
*
* Adds {@link Governance} for this {@link WebTemplate}.
*
* This enables providing {@link Governance} over all
* {@link OfficeSectionFunction} instances within the {@link WebTemplate} and
* all its subsequent {@link OfficeSubSection} instances.
*
* @param governance
* {@link OfficeGovernance}.
* @return this
.
*/
WebTemplate addGovernance(OfficeGovernance governance);
}