Class InputStreamResponse

All Implemented Interfaces:
Serializable, MapSerializable, MapWriter, NavigableObject, org.noggit.JSONWriter.Writable

public class InputStreamResponse extends SimpleSolrResponse
Represents the NamedList response format created by InputStreamResponseParser.

Particularly useful when targeting APIs that return arbitrary or binary data (e.g. replication APIs for fetching index files)

See Also:
  • Field Details

  • Constructor Details

    • InputStreamResponse

      public InputStreamResponse()
  • Method Details

    • setResponse

      public void setResponse(NamedList<Object> rsp)
      Overrides:
      setResponse in class SimpleSolrResponse
    • getHttpStatus

      public int getHttpStatus()
    • getResponseStream

      public InputStream getResponseStream()
      Access the server response as an InputStream, regardless of the HTTP status code

      Caller is responsible for consuming and closing the stream. No validation is done on the HTTP status code.

    • getResponseStreamIfSuccessful

      public InputStream getResponseStreamIfSuccessful()
      Access the server response as an InputStream, after ensuring that the HTTP status code is 200 ('OK')

      Caller is responsible for consuming and closing the stream, and releasing it from the tracking done by ObjectReleaseTracker.

    • getResponseStreamIfSuccessful

      public InputStream getResponseStreamIfSuccessful(Function<Integer,Boolean> statusValidator)
      Access the server response as an InputStream, after ensuring the HTTP status code passes a provided validator.
      Parameters:
      statusValidator - a function that returns true iff the response body should be returned