Class InputStreamResponse
java.lang.Object
org.apache.solr.client.solrj.SolrResponse
org.apache.solr.client.solrj.response.SimpleSolrResponse
org.apache.solr.client.solrj.response.InputStreamResponse
- All Implemented Interfaces:
Serializable,MapSerializable,MapWriter,NavigableObject,org.noggit.JSONWriter.Writable
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:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.solr.common.MapWriter
MapWriter.EntryWriter -
Field Summary
FieldsModifier and TypeFieldDescriptionFields inherited from class org.apache.solr.client.solrj.response.SimpleSolrResponse
elapsedTime, nl -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintAccess the server response as anInputStream, regardless of the HTTP status codeAccess the server response as anInputStream, after ensuring that the HTTP status code is 200 ('OK')getResponseStreamIfSuccessful(Function<Integer, Boolean> statusValidator) Access the server response as anInputStream, after ensuring the HTTP status code passes a provided validator.voidsetResponse(NamedList<Object> rsp) Methods inherited from class org.apache.solr.client.solrj.response.SimpleSolrResponse
getElapsedTime, getResponse, setElapsedTimeMethods inherited from class org.apache.solr.client.solrj.SolrResponse
getException, writeMapMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.solr.common.NavigableObject
_forEachEntry, _forEachEntry, _forEachEntry, _get, _get, _getStr, _getStr, _size
-
Field Details
-
HTTP_OK_VALIDATOR
-
NON_ERROR_CODE_VALIDATOR
-
-
Constructor Details
-
InputStreamResponse
public InputStreamResponse()
-
-
Method Details
-
setResponse
- Overrides:
setResponsein classSimpleSolrResponse
-
getHttpStatus
public int getHttpStatus() -
getResponseStream
Access the server response as anInputStream, regardless of the HTTP status codeCaller is responsible for consuming and closing the stream. No validation is done on the HTTP status code.
-
getResponseStreamIfSuccessful
Access the server response as anInputStream, 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
Access the server response as anInputStream, after ensuring the HTTP status code passes a provided validator.- Parameters:
statusValidator- a function that returns true iff the response body should be returned
-