Package org.appng.core.model
Class AbstractRequestProcessor
- java.lang.Object
-
- org.appng.core.model.AbstractRequestProcessor
-
- All Implemented Interfaces:
RequestProcessor
- Direct Known Subclasses:
PlatformProcessor
,ThymeleafProcessor
public abstract class AbstractRequestProcessor extends Object implements RequestProcessor
-
-
Field Summary
Fields Modifier and Type Field Description protected int
contentLength
protected String
contentType
protected DefaultEnvironment
env
protected static String
INDEX_HTML
protected MarshallService
marshallService
protected org.appng.core.model.NavigationBuilder
navigationBuilder
protected OutputFormat
outputFormat
protected OutputType
outputType
protected PathInfo
pathInfo
protected static String
PLATFORM_XML
protected boolean
redirect
protected javax.servlet.http.HttpServletRequest
servletRequest
protected javax.servlet.http.HttpServletResponse
servletResponse
protected static String
STACKTRACE_TXT
protected String
templatePath
-
Constructor Summary
Constructors Constructor Description AbstractRequestProcessor()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void
addTemplates(List<Template> templates)
protected Authentication
determineActiveAuthentication(Site site, Authentications authentications)
protected void
determineFormatAndType(PlatformConfig config, Path pathInfo)
protected ApplicationProvider
getApplicationProvider(Site site)
Integer
getContentLength()
Returns the content-length of the responseString
getContentType()
Returns the content-type of the responseprotected static String
getDebugFilePrefix(Date timestamp)
MarshallService
getMarshallService()
OutputFormat
getOutputFormat()
OutputType
getOutputType()
Platform
getPlatform(MarshallService marshallService, Path path)
Returns thePlatform
-object unmarshalled from the template's "conf/platform.xml"-file.String
getTemplatePath()
void
init(javax.servlet.http.HttpServletRequest servletRequest, javax.servlet.http.HttpServletResponse servletResponse, PathInfo pathInfo, String templateDir)
Initializes theRequestProcessor
.static void
initPlatform(Platform platform, Environment env, Path path)
boolean
isRedirect()
Returnstrue
if a redirect has been send while processing the request,false
otherwise.Platform
processPlatform(Site applicationSite)
Processes the request, but without applying the template.void
setMarshallService(MarshallService marshallService)
protected void
setRedirect(boolean redirect)
void
setTemplatePath(String templatePath)
protected static void
writeDebugFile(org.slf4j.Logger logger, File outFolder, String name, String content)
protected String
writeErrorPage(Properties platformProperties, File debugFolder, String platformXml, String templateName, Exception e, Object executionContext)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.appng.core.model.RequestProcessor
processWithTemplate
-
-
-
-
Field Detail
-
PLATFORM_XML
protected static final String PLATFORM_XML
- See Also:
- Constant Field Values
-
STACKTRACE_TXT
protected static final String STACKTRACE_TXT
- See Also:
- Constant Field Values
-
INDEX_HTML
protected static final String INDEX_HTML
- See Also:
- Constant Field Values
-
pathInfo
protected PathInfo pathInfo
-
servletRequest
protected javax.servlet.http.HttpServletRequest servletRequest
-
servletResponse
protected javax.servlet.http.HttpServletResponse servletResponse
-
marshallService
protected MarshallService marshallService
-
env
protected DefaultEnvironment env
-
redirect
protected boolean redirect
-
contentType
protected String contentType
-
contentLength
protected int contentLength
-
navigationBuilder
protected org.appng.core.model.NavigationBuilder navigationBuilder
-
templatePath
protected String templatePath
-
outputFormat
protected OutputFormat outputFormat
-
outputType
protected OutputType outputType
-
-
Method Detail
-
initPlatform
public static void initPlatform(Platform platform, Environment env, Path path)
-
processPlatform
public Platform processPlatform(Site applicationSite) throws InvalidConfigurationException
Description copied from interface:RequestProcessor
Processes the request, but without applying the template. Note thatRequestProcessor.init(HttpServletRequest, HttpServletResponse, PathInfo, String)
must have been called before.- Specified by:
processPlatform
in interfaceRequestProcessor
- Parameters:
applicationSite
- theSite
for which the process the request- Returns:
- the
Platform
representing the result of calling theSite
'sApplication
- Throws:
InvalidConfigurationException
- if something goes wrong while processing the request- See Also:
RequestProcessor.processWithTemplate(Site, File)
-
determineActiveAuthentication
protected Authentication determineActiveAuthentication(Site site, Authentications authentications)
-
init
public void init(javax.servlet.http.HttpServletRequest servletRequest, javax.servlet.http.HttpServletResponse servletResponse, PathInfo pathInfo, String templateDir)
Description copied from interface:RequestProcessor
Initializes theRequestProcessor
.- Specified by:
init
in interfaceRequestProcessor
- Parameters:
servletRequest
- the currentHttpServletRequest
servletResponse
- the currentHttpServletResponse
pathInfo
- the currentPathInfo
templateDir
- the absolute path to the directory where the active template of theSite
resides
-
isRedirect
public boolean isRedirect()
Description copied from interface:RequestProcessor
Returnstrue
if a redirect has been send while processing the request,false
otherwise.- Specified by:
isRedirect
in interfaceRequestProcessor
-
setRedirect
protected void setRedirect(boolean redirect)
-
getApplicationProvider
protected ApplicationProvider getApplicationProvider(Site site) throws InvalidConfigurationException
- Throws:
InvalidConfigurationException
-
getContentLength
public Integer getContentLength()
Description copied from interface:RequestProcessor
Returns the content-length of the response- Specified by:
getContentLength
in interfaceRequestProcessor
-
getContentType
public String getContentType()
Description copied from interface:RequestProcessor
Returns the content-type of the response- Specified by:
getContentType
in interfaceRequestProcessor
-
getMarshallService
public MarshallService getMarshallService()
-
setMarshallService
public void setMarshallService(MarshallService marshallService)
-
determineFormatAndType
protected void determineFormatAndType(PlatformConfig config, Path pathInfo)
-
getPlatform
public Platform getPlatform(MarshallService marshallService, Path path) throws InvalidConfigurationException
Returns thePlatform
-object unmarshalled from the template's "conf/platform.xml"-file. Also determines theOutputType
andOutputFormat
for the upcoming transformation.- Parameters:
marshallService
- theMarshallService
to use for unmarshallingpath
- the currentPath
-object- Returns:
- the
Platform
-object - Throws:
InvalidConfigurationException
- if the "conf/platform.xml"-file could net be found or unmarshalled.- See Also:
getOutputFormat()
,getOutputType()
-
writeErrorPage
protected String writeErrorPage(Properties platformProperties, File debugFolder, String platformXml, String templateName, Exception e, Object executionContext)
-
writeDebugFile
protected static void writeDebugFile(org.slf4j.Logger logger, File outFolder, String name, String content) throws IOException
- Throws:
IOException
-
getOutputFormat
public OutputFormat getOutputFormat()
-
getOutputType
public OutputType getOutputType()
-
getTemplatePath
public String getTemplatePath()
-
setTemplatePath
public void setTemplatePath(String templatePath)
-
-