Package com.avoka.fc.core.servlet.rest
Class AbstractRestServlet
java.lang.Object
jakarta.servlet.GenericServlet
jakarta.servlet.http.HttpServlet
com.avoka.fc.core.servlet.rest.AbstractRestServlet
- All Implemented Interfaces:
jakarta.servlet.Servlet
,jakarta.servlet.ServletConfig
,Serializable
- Direct Known Subclasses:
RestApplicationPackageV1Servlet
,RestArchiveV1Servlet
,RestConfigurationServiceV1Servlet
,RestDeliveryServiceV1Servlet
,RestFormGroupsV1Servlet
,RestGroovyServiceInvokeV1Servlet
,RestGroovyServiceInvokeV2Servlet
,RestJsAppDeployV1Servlet
,RestServiceDefinitionsV1Servlet
,RestTasksV1Servlet
,RestTestCenterV1Servlet
,RestTPacV1Servlet
,RestTransactionHistoryV1Servlet
,RestTransactionsV1Servlet
public abstract class AbstractRestServlet
extends jakarta.servlet.http.HttpServlet
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
Fields inherited from class jakarta.servlet.http.HttpServlet
LEGACY_DO_HEAD
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetMultiPartRequestMap
(jakarta.servlet.http.HttpServletRequest request) protected String[]
getNonEmptyRequestPaths
(jakarta.servlet.http.HttpServletRequest request) getRequestParamsMap
(jakarta.servlet.http.HttpServletRequest request) protected String[]
getRequestPaths
(jakarta.servlet.http.HttpServletRequest request) protected abstract String
protected org.apache.cayenne.ObjectContext
protected UserAccount
getUserAccount
(jakarta.servlet.http.HttpServletRequest request) protected boolean
isAuthorized
(UserAccount userAccount, jakarta.servlet.http.HttpServletResponse response) protected boolean
isAuthorized
(UserAccount userAccount, String permission, jakarta.servlet.http.HttpServletResponse response) protected void
logRequest
(jakarta.servlet.http.HttpServletRequest request) protected Object
marshallJsonObject
(jakarta.servlet.http.HttpServletRequest request, Class objectClass) protected void
renderJsonResponse
(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, Object responseObject) protected void
renderResponse
(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, String responseData, String contentType) protected void
setNoCacheHeaders
(jakarta.servlet.http.HttpServletResponse response) Methods inherited from class jakarta.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, init, service, service
Methods inherited from class jakarta.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, 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(jakarta.servlet.http.HttpServletRequest request, Class objectClass) throws IOException, com.google.gson.JsonSyntaxException - Throws:
IOException
com.google.gson.JsonSyntaxException
-
renderJsonResponse
protected void renderJsonResponse(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, Object responseObject) -
renderResponse
-
logRequest
protected void logRequest(jakarta.servlet.http.HttpServletRequest request) -
setNoCacheHeaders
protected void setNoCacheHeaders(jakarta.servlet.http.HttpServletResponse response) -
getUserAccount
-
isAuthorized
protected boolean isAuthorized(UserAccount userAccount, jakarta.servlet.http.HttpServletResponse response) throws IOException - Throws:
IOException
-
isAuthorized
protected boolean isAuthorized(UserAccount userAccount, String permission, jakarta.servlet.http.HttpServletResponse response) throws IOException - Throws:
IOException
-
getRequestParamsMap
protected Map<String,Object> getRequestParamsMap(jakarta.servlet.http.HttpServletRequest request) throws IOException - Throws:
IOException
-
getMultiPartRequestMap
protected Map<String,Object> getMultiPartRequestMap(jakarta.servlet.http.HttpServletRequest request) throws IOException - Throws:
IOException
-