Package com.avoka.fc.core.servlet.rest
Class AbstractRestServlet
- java.lang.Object
-
- javax.servlet.GenericServlet
-
- javax.servlet.http.HttpServlet
-
- com.avoka.fc.core.servlet.rest.AbstractRestServlet
-
- All Implemented Interfaces:
Serializable
,Servlet
,ServletConfig
- Direct Known Subclasses:
RestApplicationPackageV1Servlet
,RestDeliveryServiceV1Servlet
,RestFormGroupsV1Servlet
,RestGroovyServiceInvokeV1Servlet
,RestGroovyServiceInvokeV2Servlet
,RestJsAppDeployV1Servlet
,RestServiceDefinitionsV1Servlet
,RestTasksV1Servlet
,RestTestCenterV1Servlet
,RestTPacV1Servlet
,RestTransactionHistoryV1Servlet
,RestTransactionsV1Servlet
public abstract class AbstractRestServlet extends HttpServlet
Provides an abstract REST service Servlet.- Since:
- 4.3.0
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected static String
CONTENT_TYPE_JSON
protected ErrorLogService
errorLogService
protected org.slf4j.Logger
logger
protected UserAccountDao
userAccountDao
-
Constructor Summary
Constructors Constructor Description AbstractRestServlet()
-
Method Summary
-
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, 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
-
CONTENT_TYPE_JSON
protected static final String CONTENT_TYPE_JSON
- See Also:
- Constant Field Values
-
errorLogService
protected ErrorLogService errorLogService
-
logger
protected org.slf4j.Logger logger
-
userAccountDao
protected UserAccountDao userAccountDao
-
-
Method Detail
-
getRestBasePath
protected abstract String getRestBasePath()
- Returns:
- the REST API base path
-
getThreadObjectContext
protected org.apache.cayenne.ObjectContext getThreadObjectContext()
-
getRequestPaths
protected String[] getRequestPaths(HttpServletRequest request)
-
getNonEmptyRequestPaths
protected String[] getNonEmptyRequestPaths(HttpServletRequest request)
-
marshallJsonObject
protected Object marshallJsonObject(HttpServletRequest request, Class objectClass) throws IOException, com.google.gson.JsonSyntaxException
- Throws:
IOException
com.google.gson.JsonSyntaxException
-
renderJsonResponse
protected void renderJsonResponse(HttpServletRequest request, HttpServletResponse response, Object responseObject)
-
renderResponse
protected void renderResponse(HttpServletRequest request, HttpServletResponse response, String responseData, String contentType)
-
logRequest
protected void logRequest(HttpServletRequest request)
-
setNoCacheHeaders
protected void setNoCacheHeaders(HttpServletResponse response)
-
getUserAccount
protected UserAccount getUserAccount(HttpServletRequest request)
-
isAuthorized
protected boolean isAuthorized(UserAccount userAccount, HttpServletResponse response) throws IOException
- Throws:
IOException
-
isAuthorized
protected boolean isAuthorized(UserAccount userAccount, String permission, HttpServletResponse response) throws IOException
- Throws:
IOException
-
getRequestParamsMap
protected Map<String,Object> getRequestParamsMap(HttpServletRequest request) throws IOException
- Throws:
IOException
-
getMultiPartRequestMap
protected Map<String,Object> getMultiPartRequestMap(HttpServletRequest request) throws IOException
- Throws:
IOException
-
-