Class AbstractRestResource

java.lang.Object
com.atlassian.jira.plugins.auditing.rest.AbstractRestResource
Direct Known Subclasses:
AuditingRestResource

public class AbstractRestResource extends Object
A base class to make REST resources more structured and supportable
  • Field Details

    • log

      protected final org.apache.log4j.Logger log
    • jiraAuthenticationContext

      protected final JiraAuthenticationContext jiraAuthenticationContext
  • Constructor Details

  • Method Details

    • response

      protected javax.ws.rs.core.Response response(Callable<javax.ws.rs.core.Response> responseCallable)
      Invokes the callable and returns the response but with extra logging support.
      Parameters:
      responseCallable - the callable to invoke
      Returns:
      the Response
    • isAnonymousUser

      protected boolean isAnonymousUser()
      Returns:
      true if the current user is anonymous
    • getLoggedInUser

      protected ApplicationUser getLoggedInUser()
      Returns:
      the currently logged in user or null if they are anonymous
    • getText

      protected String getText(String key, Object... params)
      i18n's text
    • noContent

      protected javax.ws.rs.core.Response noContent()
      Returns:
      a No Content response
    • ok

      protected javax.ws.rs.core.Response ok(Object result)
      Parameters:
      result - the result object to send back
      Returns:
      a 200 OK response
    • created

      protected javax.ws.rs.core.Response created(Object result)
      Returns:
      a 201 Created response
    • notModified

      protected javax.ws.rs.core.Response notModified()
      Returns:
      a 304 Not Modified
    • errorResponse

      protected javax.ws.rs.core.Response errorResponse(String reasonKey, ErrorCollection errors)
      Returns:
      Returns an error response using the reason stored inside the ErrorCollection
    • notFoundRequest

      protected javax.ws.rs.core.Response notFoundRequest(String reasonKey)
      Returns:
      Returns a NOT_FOUND response
    • notFoundRequest

      protected javax.ws.rs.core.Response notFoundRequest(String reasonKey, String errorMessage)
      Returns:
      the NOT_FOUND response
    • notFoundRequest

      protected javax.ws.rs.core.Response notFoundRequest(String reasonKey, ErrorCollection errorCollection)
      Returns:
      Returns a NOT_FOUND response with errors from Jira
    • forbiddenRequest

      protected javax.ws.rs.core.Response forbiddenRequest(String reasonKey)
      Returns:
      Returns a FORBIDDEN response
    • forbiddenRequest

      protected javax.ws.rs.core.Response forbiddenRequest(String reasonKey, String errorMessage)
      Returns:
      the FORBIDDEN response
    • forbiddenRequest

      protected javax.ws.rs.core.Response forbiddenRequest(String reasonKey, ErrorCollection errorCollection)
      Returns:
      the FORBIDDEN response with error messages from Jira
    • unauthorizedRequest

      protected javax.ws.rs.core.Response unauthorizedRequest(String reasonKey)
      Returns:
      an UNAUTHORIZED response
    • unauthorizedRequest

      protected javax.ws.rs.core.Response unauthorizedRequest(String reasonKey, String errorMessage)
      Returns:
      the UNAUTHORIZED response
    • unauthorizedRequest

      protected javax.ws.rs.core.Response unauthorizedRequest(String reasonKey, ErrorCollection errorCollection)
      Returns:
      the UNAUTHORIZED response with error messages from Jira
    • badRequest

      protected javax.ws.rs.core.Response badRequest(String reasonKey)
      Returns:
      the BAD_REQUEST response
    • badRequest

      protected javax.ws.rs.core.Response badRequest(String reasonKey, String errorMessage)
      Returns:
      the BAD_REQUEST response
    • badRequest

      protected javax.ws.rs.core.Response badRequest(String reasonKey, ErrorCollection errorCollection)
      Returns:
      the BAD_REQUEST response with error messages from Jira