Class DataverseResponseWithoutEnvelope<B>

java.lang.Object
nl.knaw.dans.lib.dataverse.DataverseResponseWithoutEnvelope<B>
Type Parameters:
B - the type of the data of the response body
Direct Known Subclasses:
DataverseHttpResponseWithoutEnvelope, DataverseResponse

public class DataverseResponseWithoutEnvelope<B> extends Object
Response from Dataverse that is not wrapped in an envelope. Normally, Dataverse responses are wrapped in an envelope that contains metadata about the response, such as the status code and the message. In some cases, however, the response is not wrapped in an envelope. This class is used to handle such responses.
  • Constructor Details

    • DataverseResponseWithoutEnvelope

      protected DataverseResponseWithoutEnvelope(String bodyText, com.fasterxml.jackson.databind.ObjectMapper mapper, Class<?>... dataClass)
  • Method Details

    • getBodyAsObject

      public B getBodyAsObject() throws IOException
      Returns:
      the body as bean of type D
      Throws:
      com.fasterxml.jackson.core.JsonParseException - if body cannot be processed properly as JSON
      IOException
    • getBodyAsJson

      public com.fasterxml.jackson.databind.JsonNode getBodyAsJson() throws IOException
      Returns:
      the body as a JsonNode
      Throws:
      com.fasterxml.jackson.core.JsonParseException - if body cannot be processed properly as JSON
      IOException
    • getBodyAsString

      public String getBodyAsString()
      Returns:
      the body as a String