Interface ApiResponse


  • @ProviderType
    public interface ApiResponse
    An interface for providing the framework with custom values to be used in the response. An instance of ApiResponse is read only. To create an ApiResponse use ApiResponseBuilder.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.lang.Object getBody()
      Get the body to returned in the response.
      java.lang.Iterable<Modification> getChanges()  
      java.lang.String getContentType()
      Get the content type of the body returned by this ApiResponse.
      Resource getEntity()
      Get the entity to be used as the body in the response.
      java.util.Map<java.lang.String,​java.lang.String[]> getHeaders()
      Get the HTTP headers to be added to the response.
      java.lang.Integer getStatusCode()
      Get the HTTP status code to be used in the response.
      java.lang.String getStatusMessage()
      Get the HTTP status message to be used in the response.
    • Method Detail

      • getStatusCode

        @CheckForNull
        java.lang.Integer getStatusCode()
        Get the HTTP status code to be used in the response.
        Returns:
        The HTTP status code
      • getStatusMessage

        @CheckForNull
        java.lang.String getStatusMessage()
        Get the HTTP status message to be used in the response.
        Returns:
        The HTTP status message
      • getHeaders

        @CheckForNull
        java.util.Map<java.lang.String,​java.lang.String[]> getHeaders()
        Get the HTTP headers to be added to the response.
        Returns:
        The HTTP headers
      • getEntity

        @CheckForNull
        Resource getEntity()
        Get the entity to be used as the body in the response. The entity must be a Resource that can be understood by the HTTP API framework.
        Returns:
        The entity Resouce to be used as the response body.
      • getBody

        @CheckForNull
        java.lang.Object getBody()
        Get the body to returned in the response. This allows free-form response bodies, beyond the resource covered by getEntity. This method is mutually exclusive to getEntity and if this method return non-null it will be used in the response and getEntity will be ignored.
        Returns:
        An instance of CharSequence or a byte[] to be used as the response body
      • getContentType

        @CheckForNull
        java.lang.String getContentType()
        Get the content type of the body returned by this ApiResponse. This method is only used when returning a free form body using the getBody() method.
        Returns:
        The content type of the body
      • getChanges

        @CheckForNull
        java.lang.Iterable<Modification> getChanges()