Class AbstractResource

java.lang.Object
com.atlassian.jira.gadgets.system.AbstractResource
Direct Known Subclasses:
FavouriteFiltersResource, IssueTableResource, ProjectGadgetResource, RoadMapResource, SearchQueryBackedResource

public abstract class AbstractResource extends Object
Lightweight optional convenience base class for REST end points with commonly used methods.
Since:
v4.0
  • Constructor Details

    • AbstractResource

      public AbstractResource()
  • Method Details

    • createErrorResponse

      protected jakarta.ws.rs.core.Response createErrorResponse(Collection<ValidationError> errors)
      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.
    • createIndexingUnavailableResponse

      protected jakarta.ws.rs.core.Response createIndexingUnavailableResponse(String message)
    • createServerErroreResponse

      protected jakarta.ws.rs.core.Response createServerErroreResponse(String message)
    • createValidationResponse

      protected jakarta.ws.rs.core.Response createValidationResponse(Collection<ValidationError> errors)
      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 of ValidationError and 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.