|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
WebMacro Manager Interface This interface provies root access into the WebMacro system. Use it to obtain references to other WebMacro objects which you might need.
Create a new instance of this object in each thread that intends to use WebMacro, and destroy() it when you're done. It probably maintains a static reference count of the number of users of the broker, and automatically shuts down the underlying broker when the last instance is destroyed.
Field Summary | |
static java.lang.String |
BUILD_DATE
|
static java.lang.String |
VERSION
The current version of WebMacro. |
Method Summary | |
void |
destroy()
Call this method when you are finished with WebMacro. |
Broker |
getBroker()
This object is used to access components that have been plugged into WebMacro; it is shared between all instances of this class and its subclasses. |
java.lang.String |
getConfig(java.lang.String key)
Retrieve configuration information from the "config" provider. |
Context |
getContext()
Create a new Context. |
FastWriter |
getFastWriter(java.io.OutputStream out,
java.lang.String enctype)
Retrieve a FastWriter from WebMacro's internal pool of FastWriters. |
Log |
getLog(java.lang.String type)
Get a log using the type as the description |
Log |
getLog(java.lang.String type,
java.lang.String description)
Get a log to write information to. |
Template |
getTemplate(java.lang.String key)
Retrieve a template from the "template" provider. |
java.lang.String |
getURL(java.lang.String url)
Retrieve the contents of a URL as a String. |
WebContext |
getWebContext(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
Create a new WebContext object. |
boolean |
isDestroyed()
This message returns false until you destroy() this object, subsequently it returns true. |
void |
writeTemplate(java.lang.String templateName,
java.io.OutputStream out,
Context context)
Convienence method for writing a template to an OutputStream. |
void |
writeTemplate(java.lang.String templateName,
java.io.OutputStream out,
java.lang.String encoding,
Context context)
Convienence method for writing a template to an OutputStream. |
Field Detail |
public static final java.lang.String VERSION
public static final java.lang.String BUILD_DATE
Method Detail |
public void destroy()
After a call to destroy() attempts to use this object may yield unpredicatble results.
public boolean isDestroyed()
public Broker getBroker()
public FastWriter getFastWriter(java.io.OutputStream out, java.lang.String enctype) throws java.io.UnsupportedEncodingException
If using a FastWriter directly, always make sure to flush()
and close()
it when you're finished. Closing it
automatically returns back to the pool for later reuse.
out
- The output stream the FastWriter should write to. Typically
this will be your ServletOutputStreamenctype
- the Encoding type to use
java.io.UnsupportedEncodingException
- if the encoding type
specified is not supported by your JVM.public Template getTemplate(java.lang.String key) throws ResourceException
NotFoundException
- if the template was not found
ResourceException
- if the template could not be loadedpublic java.lang.String getURL(java.lang.String url) throws ResourceException
ResourceException
public java.lang.String getConfig(java.lang.String key) throws NotFoundException
NotFoundException
- could not locate requested informationpublic Context getContext()
public Log getLog(java.lang.String type, java.lang.String description)
public Log getLog(java.lang.String type)
public WebContext getWebContext(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
public void writeTemplate(java.lang.String templateName, java.io.OutputStream out, Context context) throws java.io.IOException, ResourceException, PropertyException
This method uses the TemplateOutputEncoding
defined in
WebMacro.defaults, or your custom WebMacro.properties.
templateName
- name of Template to write. Must be accessible
via TemplatePathout
- where the output of the template should gocontext
- The Context (can be a WebContext too) used
during the template evaluation phase
java.io.IOException
- if the template cannot be written to the
specified output stream
ResourceException
- if the template name specified cannot be found
PropertyException
- if a fatal error occured during the Template
evaluation phasepublic void writeTemplate(java.lang.String templateName, java.io.OutputStream out, java.lang.String encoding, Context context) throws java.io.IOException, ResourceException, PropertyException
templateName
- name of Template to write. Must be accessible
via TemplatePathout
- where the output of the template should goencoding
- character encoding to use when writing the template
if the encoding is null
, the default
TemplateOutputEncoding
is usedcontext
- The Context (can be a WebContext too) used
during the template evaluation phase
java.io.IOException
- if the template cannot be written to the
specified output stream
ResourceException
- if the template name specified cannot be found
PropertyException
- if a fatal error occured during the Template
evaluation phase
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |