Class AbstractResource
java.lang.Object
com.atlassian.jira.gadgets.system.AbstractResource
- Direct Known Subclasses:
FavouriteFiltersResource,IssueTableResource,ProjectGadgetResource,RoadMapResource,SearchQueryBackedResource
Lightweight optional convenience base class for REST end points with commonly used methods.
- Since:
- v4.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected jakarta.ws.rs.core.ResponsecreateErrorResponse(Collection<ValidationError> errors) Creates an error response using the given errors.protected jakarta.ws.rs.core.ResponsecreateIndexingUnavailableResponse(String message) protected jakarta.ws.rs.core.ResponsecreateServerErroreResponse(String message) protected jakarta.ws.rs.core.ResponseCreates a response based on the given errors.
-
Constructor Details
-
AbstractResource
public AbstractResource()
-
-
Method Details
-
createErrorResponse
Creates an error response using the given errors.- Parameters:
errors- the errors to use for the error response. Should not be empty.- Returns:
- the error response.
-
createServerErroreResponse
-
createValidationResponse
Creates a response based on the given errors. If there are no errors, the response will be NO_CONTENT (204). If there are errors, these will be used to return an error response. Many REST validate methods need to first build up a possibly empty collection ofValidationErrorand then just return the result of calling this method.- Parameters:
errors- the possibly empty collection of errors.- Returns:
- a success response if the errors are empty, otherwise an error response based on these errors.
-