public abstract class StartupFilter extends Object implements javax.servlet.Filter
UpdateFilter
,
InitializationFilter
Modifier and Type | Field and Description |
---|---|
protected List<String> |
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 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 Object |
getModel()
The model that is used as the backer for all pages in this startup wizard.
|
protected String |
getTemplatePrefix()
This string is prepended to all templateNames passed to
renderTemplate(String, Map, HttpServletResponse) |
void |
init(javax.servlet.FilterConfig filterConfig) |
protected void |
renderTemplate(String templateName,
Map<String,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 String |
toJSONString(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
protected javax.servlet.FilterConfig filterConfig
init(FilterConfig)
method so that we have access to the current
ServletContext
public final void doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain) throws IOException, javax.servlet.ServletException
StartupFilter
to be the first filter for all requests.doFilter
in interface javax.servlet.Filter
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 IOException, javax.servlet.ServletException
doFilter(ServletRequest, ServletResponse, FilterChain)
on GET requestshttpRequest
- httpResponse
- IOException
javax.servlet.ServletException
protected abstract void doPost(javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse) throws IOException, javax.servlet.ServletException
doFilter(ServletRequest, ServletResponse, FilterChain)
on POST requestshttpRequest
- httpResponse
- Exception
IOException
javax.servlet.ServletException
protected void renderTemplate(String templateName, Map<String,Object> referenceMap, javax.servlet.http.HttpServletResponse httpResponse) throws IOException
templateName
- the name of the velocity file to render. This name is prepended with
getTemplatePrefix()
referenceMap
- writer
- 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 String getTemplatePrefix()
renderTemplate(String, Map, HttpServletResponse)
protected abstract Object getModel()
public abstract boolean skipFilter(javax.servlet.http.HttpServletRequest request)
protected String toJSONString(Object object, boolean escapeJavascript)
object
- object to convert to jsonescapeJavascript
- specifies if javascript special characters should be escapedCopyright © 2018 OpenMRS LLC.. All Rights Reserved.