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
,RestArchiveV1Servlet
,RestDeliveryServiceV1Servlet
,RestFormGroupsV1Servlet
,RestGroovyServiceInvokeV1Servlet
,RestGroovyServiceInvokeV2Servlet
,RestJsAppDeployV1Servlet
,RestServiceDefinitionsV1Servlet
,RestTasksV1Servlet
,RestTestCenterV1Servlet
,RestTPacV1Servlet
,RestTransactionHistoryV1Servlet
,RestTransactionsV1Servlet
Provides an abstract REST service Servlet.
- Since:
- 4.3.0
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final String
protected ErrorLogService
protected org.slf4j.Logger
protected UserAccountDao
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetMultiPartRequestMap
(HttpServletRequest request) protected String[]
getRequestParamsMap
(HttpServletRequest request) protected String[]
getRequestPaths
(HttpServletRequest request) protected abstract String
protected org.apache.cayenne.ObjectContext
protected UserAccount
getUserAccount
(HttpServletRequest request) protected boolean
isAuthorized
(UserAccount userAccount, String permission, HttpServletResponse response) protected boolean
isAuthorized
(UserAccount userAccount, HttpServletResponse response) protected void
logRequest
(HttpServletRequest request) protected Object
marshallJsonObject
(HttpServletRequest request, Class objectClass) protected void
renderJsonResponse
(HttpServletRequest request, HttpServletResponse response, Object responseObject) protected void
renderResponse
(HttpServletRequest request, HttpServletResponse response, String responseData, String contentType) protected void
setNoCacheHeaders
(HttpServletResponse response) 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 Details
-
CONTENT_TYPE_JSON
- See Also:
-
errorLogService
-
logger
protected org.slf4j.Logger logger -
userAccountDao
-
-
Constructor Details
-
AbstractRestServlet
public AbstractRestServlet()
-
-
Method Details
-
getRestBasePath
- Returns:
- the REST API base path
-
getThreadObjectContext
protected org.apache.cayenne.ObjectContext getThreadObjectContext() -
getRequestPaths
-
getNonEmptyRequestPaths
-
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
-
setNoCacheHeaders
-
getUserAccount
-
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
- Throws:
IOException
-
getMultiPartRequestMap
- Throws:
IOException
-