Package 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 appNGApplication
inside a JSP page. This is achieved by calling the givenApplication
and then transforming the returnedPlatform
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 scopeScope.REQUEST
where the transformation result should be stored in. If this parameter is not set, the result is directly written to the JSP'sWriter
. - 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 applicationacme-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
-
-
Constructor Summary
Constructors Constructor Description ApplicationAdapter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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
-
-
-
-
Method Detail
-
setName
public void setName(String application)
-
doStartTag
public int doStartTag() throws javax.servlet.jsp.JspException
- Specified by:
doStartTag
in interfacejavax.servlet.jsp.tagext.Tag
- Overrides:
doStartTag
in classjavax.servlet.jsp.tagext.BodyTagSupport
- Throws:
javax.servlet.jsp.JspException
-
doEndTag
public final int doEndTag()
- Specified by:
doEndTag
in interfacejavax.servlet.jsp.tagext.Tag
- Overrides:
doEndTag
in classjavax.servlet.jsp.tagext.BodyTagSupport
-
addParameter
public void addParameter(String name, String value)
- Specified by:
addParameter
in interfaceParameterOwner
-
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)
-
transform
public String transform(File xslFile, String content, long templateMaxAge, boolean doTransform) throws TransformerConfigurationException, TransformerException
-
transform
public String transform(File xslFile, String content, long templateMaxAge) throws TransformerConfigurationException, TransformerException
-
-