Top Description Fields Constructors Methods
uk.ac.ed.ph.snuggletex.webapp

pack-priv abstract Class BaseServlet

extends HttpServlet
Class Inheritance
Known Direct Subclasses
uk.ac.ed.ph.snuggletex.webapp.DocumentationServlet, uk.ac.ed.ph.snuggletex.webapp.FullLaTeXInputDemoServlet, uk.ac.ed.ph.snuggletex.webapp.MathInputDemoServlet, uk.ac.ed.ph.snuggletex.webapp.MathInputToImageServlet, uk.ac.ed.ph.snuggletex.webapp.UpConversionDemoServlet, uk.ac.ed.ph.snuggletex.webapp.UpConversionExampleFragmentServlet, uk.ac.ed.ph.snuggletex.webapp.ASCIIMathMLUpConversionDemoServlet
Imports
org.w3c.dom.Element, .Node, .NodeList, uk.ac.ed.ph.snuggletex.*, .WebPageOutputOptions.WebPageType, uk.ac.ed.ph.snuggletex.definitions.W3CConstants, uk.ac.ed.ph.snuggletex.upconversion.UpConversionUtilities, uk.ac.ed.ph.snuggletex.utilities.ClassPathURIResolver, .SerializationOptions, .StylesheetCache, .StylesheetManager, javax.servlet.ServletException, javax.servlet.http.HttpServlet, .HttpServletRequest, javax.xml.transform.Templates, .Transformer, .TransformerConfigurationException, java.io.InputStream

Trivial base class for servlets in the demo webapp
Author
David McKain
Version
$Revision$

Field Summary

Modifier and TypeField and Description
private static final long

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
protected WebPageOutputOptions
chooseBestBaseWebPageOutputOptions(final HttpServletRequest request)

Convenience method to choose the most appropriate base WebPageOutputOptions for the current UserAgent, using chooseBestWebPageType(HttpServletRequest) to determine the underlying WebPageType.

protected WebPageOutputOptions.WebPageType
chooseBestWebPageType(final HttpServletRequest request)
References Deprecated WebPageOutputOptions.WebPageType is deprecated or references (maybe indirectly) at least one deprecated element.

Convenience method which picks the most appropriate MathML-based WebPageType for the current UserAgent, returning WebPageType#PROCESSED_HTML if the UserAgent does not appear to support MathML as this is the only sensible option in that case.

protected SerializationSpecifier
protected SnuggleEngine
public String
protected InputStream

Returns:

resulting InputStream, which will not be null
ensureReadResource
(String
path of Resource to load, relative to base of webapp.
resourcePathInsideWebpp
)

Helper that reads in a resource from the webapp hierarchy, throwing a ServletException if the resource could not be found.

protected Element
extractMathMLElement(final NodeList resultNodeList, final boolean allowUpConversionOptionsElements)

Untangles the given NodeList to find an expected single MathML element, and possibly some whitespace and possibly any number of <c:upconversion-options/> elements.

protected Transformer

Returns:

resulting Templates representing the compiled stylesheet.
getStylesheet
(HttpServletRequest
Request being processed (so we can pass the context path to the XSLT)
request
,
String
location of XSLT to compile.
classPathUri
)

Compiles the XSLT stylesheet at the given location within the webapp, using ClassPathURIResolver to locate the stylesheet and anything it wants to import.

protected StylesheetCache
protected StylesheetManager
protected boolean
protected boolean
Inherited from javax.servlet.http.HttpServlet:
doDeletedoGetdoHeaddoOptionsdoPostdoPutdoTracegetLastModifiedserviceservice

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Constructor Detail

BaseServletback to summary
pack-priv BaseServlet()

Method Detail

chooseBestBaseWebPageOutputOptionsback to summary
protected WebPageOutputOptions chooseBestBaseWebPageOutputOptions(final HttpServletRequest request)

Convenience method to choose the most appropriate base WebPageOutputOptions for the current UserAgent, using chooseBestWebPageType(HttpServletRequest) to determine the underlying WebPageType.

chooseBestWebPageTypeback to summary
protected WebPageOutputOptions.WebPageType chooseBestWebPageType(final HttpServletRequest request)

References Deprecated

WebPageOutputOptions.WebPageType is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Convenience method which picks the most appropriate MathML-based WebPageType for the current UserAgent, returning WebPageType#PROCESSED_HTML if the UserAgent does not appear to support MathML as this is the only sensible option in that case.

createMathMLSourceSerializationOptionsback to summary
protected SerializationSpecifier createMathMLSourceSerializationOptions()
createSnuggleEngineback to summary
protected SnuggleEngine createSnuggleEngine()
ensureGetContextInitParamback to summary
public String ensureGetContextInitParam(String propertyName) throws ServletException
ensureReadResourceback to summary
protected InputStream ensureReadResource(String resourcePathInsideWebpp) throws ServletException

Helper that reads in a resource from the webapp hierarchy, throwing a ServletException if the resource could not be found.

Parameters
resourcePathInsideWebpp:String

path of Resource to load, relative to base of webapp.

Returns:InputStream

resulting InputStream, which will not be null

extractMathMLElementback to summary
protected Element extractMathMLElement(final NodeList resultNodeList, final boolean allowUpConversionOptionsElements)

Untangles the given NodeList to find an expected single MathML element, and possibly some whitespace and possibly any number of <c:upconversion-options/> elements.

getStylesheetback to summary
protected Transformer getStylesheet(HttpServletRequest request, String classPathUri) throws ServletException

Compiles the XSLT stylesheet at the given location within the webapp, using ClassPathURIResolver to locate the stylesheet and anything it wants to import.

It also sets some core parameters based on certain properties set for the webapp.

Parameters
request:HttpServletRequest

Request being processed (so we can pass the context path to the XSLT)

classPathUri:String

location of XSLT to compile.

Returns:Transformer

resulting Templates representing the compiled stylesheet.

Exceptions
ServletException:
if XSLT could not be found or could not be compiled.
getStylesheetCacheback to summary
protected StylesheetCache getStylesheetCache()
getStylesheetManagerback to summary
protected StylesheetManager getStylesheetManager()
isInternetExplorerback to summary
protected boolean isInternetExplorer(final HttpServletRequest request)
isMathMLCapableback to summary
protected boolean isMathMLCapable(final HttpServletRequest request)