public class

RemoteResponse

extends Object
java.lang.Object
   ↳ com.atlassian.jira.plugin.link.applinks.RemoteResponse<T>

Class Overview

Represents a response from a remote resource, e.g. REST, XMLRPC.

Summary

Public Constructors
RemoteResponse(T entity, ErrorCollection errors, Response response)
RemoteResponse(T entity, Response response)
Public Methods
boolean containsErrorWithText(String... text)
Checks if any of the error messages contain all of the elements in the text list.
static <E> RemoteResponse<E> credentialsRequired(Response response)
Creates a RemoteResponse for when the endpoint requires authentication, but no credentials are available.
T getEntity()
ErrorCollection getErrors()
Returns the ErrorCollection from the response entity.
int getStatusCode()
String getStatusText()
boolean hasErrors()
Returns true if the response entity was a non-empty ErrorCollection, false if otherwise.
boolean isSuccessful()
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public RemoteResponse (T entity, ErrorCollection errors, Response response)

public RemoteResponse (T entity, Response response)

Public Methods

public boolean containsErrorWithText (String... text)

Checks if any of the error messages contain all of the elements in the text list.

Parameters
text an array of snippets to check for in the error message
Returns
  • true if an error message contains all of the elements in the text list, false if otherwise

public static RemoteResponse<E> credentialsRequired (Response response)

Creates a RemoteResponse for when the endpoint requires authentication, but no credentials are available.

Parameters
response response requiring authentication
Returns
  • RemoteResponse that requires credentials

public T getEntity ()

public ErrorCollection getErrors ()

Returns the ErrorCollection from the response entity. If the response was successful, this will generally be null.

Returns
  • the ErrorCollection from the response entity

public int getStatusCode ()

public String getStatusText ()

public boolean hasErrors ()

Returns true if the response entity was a non-empty ErrorCollection, false if otherwise.

Returns
  • true if the response entity was a non-empty ErrorCollection, false if otherwise

public boolean isSuccessful ()