|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.servlet.GenericServlet javax.servlet.http.HttpServlet org.webmacro.servlet.PanerisPage
public abstract class PanerisPage
Replacement for WMServlet
at PanEris.
This handles each request from the servlet runner by:
WebContext
;doPaneris()
;handle(WebContext)
method;The PanEris specific processing:
ContextUtil
in the context;PageContent
(by
first getting the User
);DDRecord
for the style
and retrieving the path from that. The default style is obtained using a
SystemProperties
);It remains to provide a definition for handle(WebContext)
.
Broker
,
Serialized FormField Summary | |
---|---|
protected org.webmacro.Log |
_log
Log object used to write out messages |
Fields inherited from interface org.webmacro.WebMacro |
---|
BUILD_DATE, VERSION |
Constructor Summary | |
---|---|
PanerisPage()
|
Method Summary | |
---|---|
void |
destroy()
This method is called by the servlet runner--do not call it. |
void |
destroyContext(org.webmacro.servlet.WebContext wc)
This method is called at the end of a request and is responsible for cleaning up the Context at the end of the request. |
protected void |
doGet(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
Process an incoming GET request: Builds a WebContext up and then passes it to the handle() method. |
protected void |
doPost(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
Behaves exactly like doGet() except that it reads data from POST before doing exactly the same thing. |
protected org.webmacro.Template |
error(org.webmacro.servlet.WebContext context,
java.lang.String error)
Create an error template using the built in error handler. |
protected void |
execute(org.webmacro.Template tmpl,
org.webmacro.servlet.WebContext c)
This method takes a populated context and a template and writes out the interpreted template to the context's output stream. |
org.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. |
java.lang.String |
getConfig(java.lang.String key,
java.lang.String defaultValue)
Retrieve configuration information from the "config" provider. |
org.webmacro.Context |
getContext()
Create a new Context object |
org.webmacro.Template |
getErrorTemplate()
Gets a template for displaying an error message. |
protected java.lang.String |
getErrorTemplateName()
|
protected java.lang.String |
getErrorVariableName()
Returns the name of the error variable, as per the config. |
org.webmacro.FastWriter |
getFastWriter(java.io.OutputStream out,
java.lang.String enctype)
Deprecated. |
org.webmacro.Log |
getLog(java.lang.String type)
Get a Log object which can be used to write to the log file. |
org.webmacro.Log |
getLog(java.lang.String type,
java.lang.String description)
Get a Log object which can be used to write to the log file. |
org.webmacro.Template |
getTemplate(java.lang.String key)
Retrieve a template from the "template" provider. |
java.lang.String |
getURL(java.lang.String url)
Retrieve a URL. |
org.webmacro.servlet.WebContext |
getWebContext(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
Create a new WebContext object; can be overridden |
abstract org.webmacro.Template |
handle(org.webmacro.servlet.WebContext context)
This method is called to handle the processing of a request. |
void |
init()
This method is called by the servlet runner--do not call it. |
void |
init(javax.servlet.ServletConfig sc)
This is the old-style init method, it just calls init(), after handing the ServletConfig object to the superclass |
org.webmacro.servlet.WebContext |
initWebContext()
Deprecated. |
org.webmacro.WebMacro |
initWebMacro()
This method returns the WebMacro object which will be used to load, access, and manage the Broker. |
org.webmacro.servlet.WebContext |
newContext(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
This method is called at the beginning of a request and is responsible for providing a Context for the request. |
org.webmacro.servlet.WebContext |
newWebContext(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
|
protected void |
setLocale(javax.servlet.http.HttpServletResponse resp,
java.util.Locale locale)
Set the locale on the response. |
protected void |
start()
Override this method to implement any startup/init code you require. |
protected void |
stop()
Override this method to implement any shutdown code you require. |
void |
writeTemplate(java.lang.String templateName,
java.io.OutputStream out,
org.webmacro.Context context)
Convenience method for writing a template to an OutputStream. |
void |
writeTemplate(java.lang.String templateName,
java.io.OutputStream out,
java.lang.String encoding,
org.webmacro.Context context)
Convienence method for writing a template to an OutputStream. |
Methods inherited from class javax.servlet.http.HttpServlet |
---|
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service |
Methods inherited from class javax.servlet.GenericServlet |
---|
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, log, log |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected org.webmacro.Log _log
Constructor Detail |
---|
public PanerisPage()
Method Detail |
---|
public void init(javax.servlet.ServletConfig sc) throws javax.servlet.ServletException
init
in interface javax.servlet.Servlet
init
in class javax.servlet.GenericServlet
javax.servlet.ServletException
- if it failed to initializepublic void init()
init
in class javax.servlet.GenericServlet
public void destroy()
destroy
in interface javax.servlet.Servlet
destroy
in class javax.servlet.GenericServlet
protected void doGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws javax.servlet.ServletException, java.io.IOException
doGet
in class javax.servlet.http.HttpServlet
req
- the request we gotresp
- the response we are generating
javax.servlet.ServletException
- if we can't get our configuration
java.io.IOException
- if we can't write to the output streamprotected void doPost(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws javax.servlet.ServletException, java.io.IOException
doPost
in class javax.servlet.http.HttpServlet
req
- the request we gotresp
- the response we are generating
javax.servlet.ServletException
- if we can't get our configuration
java.io.IOException
- if we can't read/write to the streams we gotprotected org.webmacro.Template error(org.webmacro.servlet.WebContext context, java.lang.String error)
context
- will add error variable to context (see Config)error
- a string explaining what went wrongprotected java.lang.String getErrorVariableName()
Returns the name of the error variable, as per the config.
public org.webmacro.Broker getBroker()
getBroker
in interface org.webmacro.WebMacro
public org.webmacro.Log getLog(java.lang.String type, java.lang.String description)
getLog
in interface org.webmacro.WebMacro
public org.webmacro.Log getLog(java.lang.String type)
getLog
in interface org.webmacro.WebMacro
public org.webmacro.Template getTemplate(java.lang.String key) throws org.webmacro.ResourceException
getTemplate
in interface org.webmacro.WebMacro
org.webmacro.NotFoundException
- if the template was not found
org.webmacro.ResourceException
- if the template coult not be loadedpublic java.lang.String getURL(java.lang.String url) throws org.webmacro.ResourceException
getURL
in interface org.webmacro.WebMacro
org.webmacro.ResourceException
public java.lang.String getConfig(java.lang.String key) throws org.webmacro.NotFoundException
getConfig
in interface org.webmacro.WebMacro
org.webmacro.NotFoundException
- could not locate requested informationpublic java.lang.String getConfig(java.lang.String key, java.lang.String defaultValue)
public org.webmacro.Context getContext()
getContext
in interface org.webmacro.WebMacro
public org.webmacro.servlet.WebContext getWebContext(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
getWebContext
in interface org.webmacro.WebMacro
public void writeTemplate(java.lang.String templateName, java.io.OutputStream out, org.webmacro.Context context) throws java.io.IOException, org.webmacro.ResourceException, org.webmacro.PropertyException
This method uses the default TemplateOutputEncoding
specified in
WebMacro.defaults or your custom WebMacro.properties.
writeTemplate
in interface org.webmacro.WebMacro
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
org.webmacro.ResourceException
- if the template name specified cannot be found
org.webmacro.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, org.webmacro.Context context) throws java.io.IOException, org.webmacro.ResourceException, org.webmacro.PropertyException
writeTemplate
in interface org.webmacro.WebMacro
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
org.webmacro.ResourceException
- if the template name specified cannot be found
org.webmacro.PropertyException
- if a fatal error occured during the Template
evaluation phaseprotected void execute(org.webmacro.Template tmpl, org.webmacro.servlet.WebContext c) throws java.io.IOException
java.io.IOException
public org.webmacro.servlet.WebContext newContext(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws org.webmacro.servlet.HandlerException
org.webmacro.servlet.HandlerException
public abstract org.webmacro.Template handle(org.webmacro.servlet.WebContext context) throws org.webmacro.servlet.HandlerException
context
- contains all relevant data structures, incl builtins.
HandlerException
- throw this to produce vanilla error messagespublic void destroyContext(org.webmacro.servlet.WebContext wc) throws org.webmacro.servlet.HandlerException
org.webmacro.servlet.HandlerException
protected void start() throws javax.servlet.ServletException
javax.servlet.ServletException
- to indicate initialization failedprotected void stop()
public org.webmacro.WebMacro initWebMacro() throws org.webmacro.InitException
org.webmacro.InitException
public final org.webmacro.servlet.WebContext initWebContext() throws org.webmacro.InitException
org.webmacro.InitException
public org.webmacro.servlet.WebContext newWebContext(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
protected void setLocale(javax.servlet.http.HttpServletResponse resp, java.util.Locale locale)
public org.webmacro.FastWriter getFastWriter(java.io.OutputStream out, java.lang.String enctype) throws java.io.UnsupportedEncodingException
getFastWriter
in interface org.webmacro.WebMacro
out
- The output stream the FastWriter should write to. Typically
this will be your ServletOutputStreamenctype
- the Encoding type to use
java.io.UnsupportedEncodingException
public org.webmacro.Template getErrorTemplate()
protected java.lang.String getErrorTemplateName()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |