public final class WebPageBuilder extends Object
List of fixed FlowTokens, using the supplied
WebPageOutputOptions to determine the exact form of the results.| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_MATHJAX_URL
Default URL and config to use when MathJax configuration option has been enabled.
|
| Constructor and Description |
|---|
WebPageBuilder(SessionContext sessionContext,
WebPageOutputOptions options) |
| Modifier and Type | Method and Description |
|---|---|
Document |
buildWebPage(List<FlowToken> fixedTokens) |
String |
buildWebPageString(List<FlowToken> fixedTokens) |
void |
setWebPageContentType(Object contentTypeSettable)
Calls the
setContentType method for the given Object (by reflection) to something
appropriate for serving the types of web pages generated by this builder over HTTP. |
void |
writeWebPage(List<FlowToken> fixedTokens,
Object contentTypeSettable,
OutputStream outputStream,
SnuggleSession.EndOutputAction endOutputOptions)
Creates a web page representing the given (fixed) Tokens, and writes the results to
the given
OutputStream. |
public static final String DEFAULT_MATHJAX_URL
public WebPageBuilder(SessionContext sessionContext, WebPageOutputOptions options)
public final Document buildWebPage(List<FlowToken> fixedTokens) throws SnuggleParseException
SnuggleParseExceptionpublic final String buildWebPageString(List<FlowToken> fixedTokens) throws SnuggleParseException
SnuggleParseExceptionpublic final void writeWebPage(List<FlowToken> fixedTokens, Object contentTypeSettable, OutputStream outputStream, SnuggleSession.EndOutputAction endOutputOptions) throws SnuggleParseException, IOException
OutputStream.fixedTokens - fixed Tokens from earlier stages of parsingcontentTypeSettable - optional bean Object that will have its contentType
property set if provided. (This is generally useful as a proxy for the HttpResponse
Object in the servlet API, which I want to avoid a compile-time dependency on.)outputStream - Stream to send the resulting page to, which will be closed afterwards.endOutputOptions - specifies what to do with the outputStream once we've finished writing
to it.SnuggleParseExceptionIOExceptionSnuggleRuntimeException - if calling setContentType() on the contentTypeSettable
Object failed, with the underlying Exception wrapped up.public final void setWebPageContentType(Object contentTypeSettable)
setContentType method for the given Object (by reflection) to something
appropriate for serving the types of web pages generated by this builder over HTTP.
(The main example for this would be passing a javax.servlet.http.HttpResponse
Object, which I want to avoid a compile-time dependency on.)
contentTypeSettable - Object that will have its contentType
property set if provided.Copyright © 2008–2026 The University of Edinburgh. All rights reserved.