public abstract class StartupFilter
extends java.lang.Object
implements javax.servlet.Filter
UpdateFilter
,
InitializationFilter
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
AUTO_RUN_OPENMRS |
protected java.util.Map<java.lang.String,java.lang.Object[]> |
errors
Records errors that will be displayed to the user
|
protected javax.servlet.FilterConfig |
filterConfig
Set by the
init(FilterConfig) method so that we have access to the current
ServletContext |
protected org.apache.commons.logging.Log |
log |
protected java.util.Map<java.lang.String,java.lang.Object[]> |
msgs
Messages that will be displayed to the user
|
protected static org.apache.velocity.app.VelocityEngine |
velocityEngine |
Constructor and Description |
---|
StartupFilter() |
Modifier and Type | Method and Description |
---|---|
void |
destroy() |
void |
doFilter(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response,
javax.servlet.FilterChain chain)
The web.xml file sets this
StartupFilter to be the first filter for all requests. |
protected abstract void |
doGet(javax.servlet.http.HttpServletRequest httpRequest,
javax.servlet.http.HttpServletResponse httpResponse)
Called by
doFilter(ServletRequest, ServletResponse, FilterChain) on GET requests |
protected abstract void |
doPost(javax.servlet.http.HttpServletRequest httpRequest,
javax.servlet.http.HttpServletResponse httpResponse)
Called by
doFilter(ServletRequest, ServletResponse, FilterChain) on POST requests |
protected abstract java.lang.Object |
getModel()
The model that is used as the backer for all pages in this startup wizard.
|
protected java.lang.String |
getTemplatePrefix()
This string is prepended to all templateNames passed to
renderTemplate(String, Map, HttpServletResponse) |
org.apache.velocity.tools.ToolContext |
getToolContext(java.lang.String locale)
Gets tool context for specified locale parameter.
|
void |
init(javax.servlet.FilterConfig filterConfig) |
protected void |
renderTemplate(java.lang.String templateName,
java.util.Map<java.lang.String,java.lang.Object> referenceMap,
javax.servlet.http.HttpServletResponse httpResponse)
All private attributes on this class are returned to the template via the velocity context
and reflection
|
abstract boolean |
skipFilter(javax.servlet.http.HttpServletRequest request)
If this returns true, this filter fails early and quickly.
|
protected java.lang.String |
toJSONString(java.lang.Object object,
boolean escapeJavascript)
Convenience method to convert the given object to a JSON string.
|
protected final org.apache.commons.logging.Log log
protected static org.apache.velocity.app.VelocityEngine velocityEngine
public static final java.lang.String AUTO_RUN_OPENMRS
protected javax.servlet.FilterConfig filterConfig
init(FilterConfig)
method so that we have access to the current
ServletContext
protected java.util.Map<java.lang.String,java.lang.Object[]> errors
protected java.util.Map<java.lang.String,java.lang.Object[]> msgs
public final void doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain) throws java.io.IOException, javax.servlet.ServletException
StartupFilter
to be the first filter for all requests.doFilter
in interface javax.servlet.Filter
java.io.IOException
javax.servlet.ServletException
Filter.doFilter(javax.servlet.ServletRequest,
javax.servlet.ServletResponse, javax.servlet.FilterChain)
protected abstract void doGet(javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse) throws java.io.IOException, javax.servlet.ServletException
doFilter(ServletRequest, ServletResponse, FilterChain)
on GET requestshttpRequest
- httpResponse
- java.io.IOException
javax.servlet.ServletException
protected abstract void doPost(javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse) throws java.io.IOException, javax.servlet.ServletException
doFilter(ServletRequest, ServletResponse, FilterChain)
on POST requestshttpRequest
- httpResponse
- java.lang.Exception
java.io.IOException
javax.servlet.ServletException
protected void renderTemplate(java.lang.String templateName, java.util.Map<java.lang.String,java.lang.Object> referenceMap, javax.servlet.http.HttpServletResponse httpResponse) throws java.io.IOException
templateName
- the name of the velocity file to render. This name is prepended with
getTemplatePrefix()
referenceMap
- writer
- java.io.IOException
public void init(javax.servlet.FilterConfig filterConfig) throws javax.servlet.ServletException
init
in interface javax.servlet.Filter
javax.servlet.ServletException
Filter.init(javax.servlet.FilterConfig)
public void destroy()
destroy
in interface javax.servlet.Filter
Filter.destroy()
protected java.lang.String getTemplatePrefix()
renderTemplate(String, Map, HttpServletResponse)
protected abstract java.lang.Object getModel()
public abstract boolean skipFilter(javax.servlet.http.HttpServletRequest request)
protected java.lang.String toJSONString(java.lang.Object object, boolean escapeJavascript)
object
- object to convert to jsonescapeJavascript
- specifies if javascript special characters should be escapedpublic org.apache.velocity.tools.ToolContext getToolContext(java.lang.String locale)
LocalizationTool
object, that is being contained in tools contextlocale
- the string with locale parameter for configuring tools contextCopyright © 2018 OpenMRS Inc.. All Rights Reserved.