Package com.avoka.fc.core.servlet
Class BaseServlet
- java.lang.Object
-
- javax.servlet.GenericServlet
-
- javax.servlet.http.HttpServlet
-
- com.avoka.fc.core.servlet.BaseServlet
-
- All Implemented Interfaces:
Serializable
,Servlet
,ServletConfig
- Direct Known Subclasses:
EmailVerificationServlet
,FormDynamicDataServlet
,HostedPaymentServlet
,ReceiptCommandServlet
,RenderServlet
,SubmissionServlet
public abstract class BaseServlet extends HttpServlet
Provides a base servlet for other servlet to extend.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
PAGE_InvalidRequest
The invalid request pagestatic String
PAGE_Offline
The offline page
-
Constructor Summary
Constructors Constructor Description BaseServlet()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
doGet(HttpServletRequest request, HttpServletResponse response)
protected void
doPost(HttpServletRequest request, HttpServletResponse response)
protected abstract void
executeRequest(HttpServletRequest request, HttpServletResponse response)
Abstract execute request method subclasses must implement.protected org.apache.cayenne.access.DataContext
getDataContext()
protected DeploymentPropertyDao
getDeploymentPropertyDao()
protected abstract ErrorLogService
getErrorLogService()
protected String
getErrorPagePath(HttpServletRequest request)
protected org.slf4j.Logger
getLogger()
Return the service log.protected Map<String,Object>
getMultiPartRequestMap(HttpServletRequest request)
protected String
getParameterString(HttpServletRequest request, String name)
This will return "" if there is a null value.protected String
getParameterString(HttpServletRequest request, String name, String defaultValue)
protected String
getParameterStringTrim(HttpServletRequest request, String name)
returns the string parameter, stripping out anything from the first '#' character e.g.protected HttpServletRequest
getRequest()
Map
getRequestParameters()
Return an ordered map of request parameters from the request.protected HttpServletResponse
getResponse()
protected void
handleException(Throwable error, String userName, HttpServletRequest request, HttpServletResponse response)
protected void
handleRequest(HttpServletRequest request, HttpServletResponse response)
protected void
listServletInfo(HttpServletRequest request)
List all the servlet request information when in application is in debug mode.protected void
sendRedirect(HttpServletRequest request, HttpServletResponse response, String path)
protected void
sendResponseError(int status)
Set the response error status code.-
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service
-
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log
-
-
-
-
Field Detail
-
PAGE_Offline
public static final String PAGE_Offline
The offline page- See Also:
- Constant Field Values
-
PAGE_InvalidRequest
public static final String PAGE_InvalidRequest
The invalid request page- See Also:
- Constant Field Values
-
-
Method Detail
-
executeRequest
protected abstract void executeRequest(HttpServletRequest request, HttpServletResponse response) throws IOException
Abstract execute request method subclasses must implement. Subclasses should not override the doGet or doPost methods.- Parameters:
request
- the servlet requestresponse
- the servlet response- Throws:
InvalidParameterException
- if an invalid request occursIOException
- if an invalid request occurs
-
getErrorLogService
protected abstract ErrorLogService getErrorLogService()
- Returns:
- the servlet error log service
- Since:
- 4.3.4
-
doGet
protected final void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
- Overrides:
doGet
in classHttpServlet
- Throws:
ServletException
IOException
-
doPost
protected final void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
- Overrides:
doPost
in classHttpServlet
- Throws:
ServletException
IOException
-
handleRequest
protected void handleRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
- Throws:
ServletException
IOException
-
handleException
protected void handleException(Throwable error, String userName, HttpServletRequest request, HttpServletResponse response)
-
getErrorPagePath
protected String getErrorPagePath(HttpServletRequest request)
-
sendResponseError
protected void sendResponseError(int status)
Set the response error status code.- Parameters:
status
- the error status- Since:
- 4.1.0
-
getLogger
protected org.slf4j.Logger getLogger()
Return the service log.
-
getDataContext
protected org.apache.cayenne.access.DataContext getDataContext()
-
getDeploymentPropertyDao
protected DeploymentPropertyDao getDeploymentPropertyDao()
-
getRequest
protected HttpServletRequest getRequest()
-
getResponse
protected HttpServletResponse getResponse()
-
getParameterString
protected String getParameterString(HttpServletRequest request, String name)
This will return "" if there is a null value.
-
getParameterString
protected String getParameterString(HttpServletRequest request, String name, String defaultValue)
-
getParameterStringTrim
protected String getParameterStringTrim(HttpServletRequest request, String name)
returns the string parameter, stripping out anything from the first '#' character e.g. submitKey=12345#zoom=100 becomes 12345 rather than 12345#zoom=100
-
getRequestParameters
public Map getRequestParameters()
Return an ordered map of request parameters from the request.- Returns:
- the ordered map of request parameters
-
listServletInfo
protected void listServletInfo(HttpServletRequest request)
List all the servlet request information when in application is in debug mode.
-
sendRedirect
protected void sendRedirect(HttpServletRequest request, HttpServletResponse response, String path) throws ApplicationException
- Throws:
ApplicationException
-
getMultiPartRequestMap
protected Map<String,Object> getMultiPartRequestMap(HttpServletRequest request) throws org.apache.commons.fileupload.FileUploadException
- Throws:
org.apache.commons.fileupload.FileUploadException
-
-