public abstract class StartupFilter extends Object implements javax.servlet.Filter
UpdateFilter
,
InitializationFilter
Modifier and Type | Field and Description |
---|---|
static String |
AUTO_RUN_OPENMRS |
protected Map<String,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 Map<String,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 |
---|---|
protected void |
addLogLinesToResponse(Map<String,Object> result)
Convenience method to read the last 5 log lines from the MemoryAppender
The log lines will be added to the "logLines" key
|
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 String |
getTemplatePrefix()
This string is prepended to all templateNames passed to
renderTemplate(String, Map, HttpServletResponse) |
org.apache.velocity.tools.ToolContext |
getToolContext(String locale)
Gets tool context for specified locale parameter.
|
protected abstract Object |
getUpdateFilterModel()
The model that is used as the backer for all pages in this startup wizard.
|
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)
Convenience method to convert the given object to a JSON string.
|
protected static org.apache.velocity.app.VelocityEngine velocityEngine
public static final String AUTO_RUN_OPENMRS
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
- 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
- httpResponse
- 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 getUpdateFilterModel()
public abstract boolean skipFilter(javax.servlet.http.HttpServletRequest request)
protected void addLogLinesToResponse(Map<String,Object> result)
result
- A map to be returned as a JSON documentprotected String toJSONString(Object object)
object
- object to convert to jsonpublic org.apache.velocity.tools.ToolContext getToolContext(String locale)
LocalizationTool
object, that is being contained in tools contextlocale
- the string with locale parameter for configuring tools contextCopyright © 2024 OpenMRS Inc.. All rights reserved.