org.appng.taglib

## Class ApplicationAdapter

- java.lang.Object
- - javax.servlet.jsp.tagext.TagSupport
  - - javax.servlet.jsp.tagext.BodyTagSupport
    - - org.appng.taglib.ApplicationAdapter

- All Implemented Interfaces:
    Serializable, javax.servlet.jsp.tagext.BodyTag, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.JspTag, javax.servlet.jsp.tagext.Tag, ParameterOwner

      public final class ApplicationAdapter
      extends javax.servlet.jsp.tagext.BodyTagSupport
      implements ParameterOwner

  Used to embed an appNG `Application` inside a JSP page. This is achieved by calling the given `Application` and then transforming the returned `Platform` using an XSLT stylesheet.

  Attributes:

  - application - the name of the `Application` that should be embedded.

  Parameters: (`<appNG:param>`)

  - defaultBaseUrl - the url of the page where the application is embedded
  - defaultPage - The default page of the application, used when the url parameters do not contain a page name
  - xslStyleSheet - The path to the XSLT stylesheet used for transformation, relative to the `Site`'s repository folder. If omitted, the plain XML is written as an HTML comment
  - requestAttribute - The name of an `Environment`-attribute with the scope `Scope.REQUEST` where the transformation result should be stored in. If this parameter is not set, the result is directly written to the JSP's `Writer`.
  - locale - The locale to use, for example en_US or es_MX

  GET-Parameters:

  - xsl - if `false`, the plain XML is written as an HTML comment

  Usage:
  The following example assumes you want to embed the application `acme-app` into the page `/en/acme`.
  Every path segment after `/en/acme` is passed as an url-parameter to the application.

       <appNG:application name="acme-app">
         <appNG:param name="defaultBaseUrl">/en/acme</appNG:param>
         <appNG:param name="defaultPage">/index/welcome</appNG:param>
         <appNG:param name="xslStyleSheet">/meta/xsl/acme/platform.xsl</appNG:param>
         <appNG:param name="requestAttribute">acmeResult</appNG:param>
       </appNG:application>
       <!-- later in JSP -->
       <appNG:attribute mode="read" name="acmeResult" scope="REQUEST" />

  Author:
    Matthias Müller
  See Also:
    Serialized Form

- - ### Field Summary

    - ### Fields inherited from class javax.servlet.jsp.tagext.BodyTagSupport

      `bodyContent`

    - ### Fields inherited from class javax.servlet.jsp.tagext.TagSupport

      `id, pageContext`

    - ### Fields inherited from interface javax.servlet.jsp.tagext.BodyTag

      `EVAL_BODY_BUFFERED, EVAL_BODY_TAG`

    - ### Fields inherited from interface javax.servlet.jsp.tagext.IterationTag

      `EVAL_BODY_AGAIN`

    - ### Fields inherited from interface javax.servlet.jsp.tagext.Tag

      `EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ApplicationAdapter()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addParameter(String name, String value)`
    `int` | `doEndTag()`
    `protected int` | `doRedirect(javax.servlet.http.HttpServletResponse servletResponse, String location, String redirectTarget)`
    `int` | `doStartTag()`
    `protected String` | `getBaseUrl(String defaultBaseUrl, List<String> urlParameters, String jspExtension, String repositoryPath, String requestURI)`
    `protected String` | `normalizeUrl(Site executingSite, String location, String baseUrl)`
    `void` | `setName(String application)`
    `String` | `transform(File xslFile, String content, long templateMaxAge)`
    `String` | `transform(File xslFile, String content, long templateMaxAge, boolean doTransform)`

    - ### Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport

      `doAfterBody, doInitBody, getBodyContent, getPreviousOut, release, setBodyContent`

    - ### Methods inherited from class javax.servlet.jsp.tagext.TagSupport

      `findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setPageContext, setParent, setValue`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface javax.servlet.jsp.tagext.Tag

      `getParent, setPageContext, setParent`

- - ### Constructor Detail

    - #### ApplicationAdapter

          public ApplicationAdapter()

  - ### Method Detail

    - #### setName

          public void setName(String application)

    - #### doStartTag

          public int doStartTag()
                         throws javax.servlet.jsp.JspException

      Specified by:
        `doStartTag` in interface `javax.servlet.jsp.tagext.Tag`
      Overrides:
        `doStartTag` in class `javax.servlet.jsp.tagext.BodyTagSupport`
      Throws:
        `javax.servlet.jsp.JspException`

    - #### doEndTag

          public final int doEndTag()

      Specified by:
        `doEndTag` in interface `javax.servlet.jsp.tagext.Tag`
      Overrides:
        `doEndTag` in class `javax.servlet.jsp.tagext.BodyTagSupport`

    - #### addParameter

          public void addParameter(String name,
                                   String value)

      Specified by:
        `addParameter` in interface `ParameterOwner`

    - #### doRedirect

          protected int doRedirect(javax.servlet.http.HttpServletResponse servletResponse,
                                   String location,
                                   String redirectTarget)
                            throws IOException

      Throws:
        `IOException`

    - #### getBaseUrl

          protected String getBaseUrl(String defaultBaseUrl,
                                      List<String> urlParameters,
                                      String jspExtension,
                                      String repositoryPath,
                                      String requestURI)

    - #### normalizeUrl

          protected String normalizeUrl(Site executingSite,
                                        String location,
                                        String baseUrl)

    - #### transform

          public String transform(File xslFile,
                                  String content,
                                  long templateMaxAge,
                                  boolean doTransform)
                           throws TransformerConfigurationException,
                                  TransformerException

      Throws:
        `TransformerConfigurationException`
        `TransformerException`

    - #### transform

          public String transform(File xslFile,
                                  String content,
                                  long templateMaxAge)
                           throws TransformerConfigurationException,
                                  TransformerException

      Throws:
        `TransformerConfigurationException`
        `TransformerException`

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