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 and 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 and Description
    `AbstractRequestProcessor()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and 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 response
    `String` | `getContentType()` Returns the content-type of the response
    `protected static String` | `getDebugFilePrefix(Date timestamp)`
    `MarshallService` | `getMarshallService()`
    `OutputFormat` | `getOutputFormat()`
    `OutputType` | `getOutputType()`
    `Platform` | `getPlatform(MarshallService marshallService, Path path)` Returns the `Platform`-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 the `RequestProcessor`.
    `static void` | `initPlatform(Platform platform, Environment env, Path path)`
    `boolean` | `isRedirect()` Returns `true` 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

  - ### Constructor Detail

    - #### AbstractRequestProcessor

          public AbstractRequestProcessor()

  - ### 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 that `RequestProcessor.init(HttpServletRequest, HttpServletResponse, PathInfo, String)` must have been called before.
      Specified by:
        `processPlatform` in interface `RequestProcessor`
      Parameters:
        `applicationSite` - the `Site` for which the process the request
      Returns:
        the `Platform` representing the result of calling the `Site`'s `Application`
      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 the `RequestProcessor`.
      Specified by:
        `init` in interface `RequestProcessor`
      Parameters:
        `servletRequest` - the current `HttpServletRequest`
        `servletResponse` - the current `HttpServletResponse`
        `pathInfo` - the current `PathInfo`
        `templateDir` - the absolute path to the directory where the active template of the `Site` resides

    - #### isRedirect

          public boolean isRedirect()

      Description copied from interface: `RequestProcessor`
      Returns `true` if a redirect has been send while processing the request, `false` otherwise.
      Specified by:
        `isRedirect` in interface `RequestProcessor`

    - #### setRedirect

          protected void setRedirect(boolean redirect)

    - #### addTemplates

          protected abstract void addTemplates(List<Template> templates)

    - #### 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 interface `RequestProcessor`

    - #### getContentType

          public String getContentType()

      Description copied from interface: `RequestProcessor`
      Returns the content-type of the response
      Specified by:
        `getContentType` in interface `RequestProcessor`

    - #### 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 the `Platform`-object unmarshalled from the template's "conf/platform.xml"-file. Also determines the `OutputType` and `OutputFormat` for the upcoming transformation.
      Parameters:
        `marshallService` - the `MarshallService` to use for unmarshalling
        `path` - the current `Path`-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`

    - #### getDebugFilePrefix

          protected static String getDebugFilePrefix(Date timestamp)

    - #### getOutputFormat

          public OutputFormat getOutputFormat()

    - #### getOutputType

          public OutputType getOutputType()

    - #### getTemplatePath

          public String getTemplatePath()

    - #### setTemplatePath

          public void setTemplatePath(String templatePath)

Copyright © 2011–2023 aiticon GmbH. All rights reserved.