Package org.apache.solr.client.solrj
Class SolrRequest<T extends SolrResponse>
- java.lang.Object
- 
- org.apache.solr.client.solrj.SolrRequest<T>
 
- 
- All Implemented Interfaces:
- Serializable
 - Direct Known Subclasses:
- AbstractSchemaRequest,- AbstractUpdateRequest,- CollectionAdminRequest,- ConfigSetAdminRequest,- CoreAdminRequest,- DelegationTokenRequest,- DirectXmlRequest,- DocumentAnalysisRequest,- FieldAnalysisRequest,- GenericSolrRequest,- HealthCheckRequest,- LukeRequest,- QueryRequest,- SolrPing,- V2Request
 
 public abstract class SolrRequest<T extends SolrResponse> extends Object implements Serializable - Since:
- solr 1.3
- See Also:
- Serialized Form
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classSolrRequest.METHODstatic classSolrRequest.SolrClientContextstatic classSolrRequest.SolrRequestType
 - 
Field SummaryFields Modifier and Type Field Description static Set<String>SUPPORTED_METHODSprotected booleanuseBinaryV2protected booleanusev2
 - 
Constructor SummaryConstructors Constructor Description SolrRequest(SolrRequest.METHOD m, String path)
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddHeader(String key, String value)protected abstract TcreateResponse(SolrClient client)Create a new SolrResponse to hold the response from the serverStringgetBasePath()StringgetBasicAuthPassword()StringgetBasicAuthUser()StringgetCollection()Collection<ContentStream>getContentStreams()Deprecated.Please usegetContentWriter(String)instead.RequestWriter.ContentWritergetContentWriter(String expectedType)If a request object wants to do a push write, implement this method.Map<String,String>getHeaders()SolrRequest.METHODgetMethod()abstract SolrParamsgetParams()StringgetPath()List<String>getPreferredNodes()Set<String>getQueryParams()Parameter keys that are sent via the query stringabstract StringgetRequestType()This method defines the type of this Solr request.ResponseParsergetResponseParser()StreamingResponseCallbackgetStreamingResponseCallback()PrincipalgetUserPrincipal()Tprocess(SolrClient client)Send this request to aSolrClientand return the responseTprocess(SolrClient client, String collection)Send this request to aSolrClientand return the responsevoidsetBasePath(String path)SolrRequest<T>setBasicAuthCredentials(String user, String password)voidsetMethod(SolrRequest.METHOD method)voidsetPath(String path)SolrRequest<T>setPreferredNodes(List<String> nodes)voidsetQueryParams(Set<String> queryParams)voidsetResponseParser(ResponseParser responseParser)Optionally specify how the Response should be parsed.voidsetStreamingResponseCallback(StreamingResponseCallback callback)SolrRequest<T>setUseBinaryV2(boolean flag)If set to true use javabin instead of json (default)voidsetUserPrincipal(Principal userPrincipal)SolrRequest<T>setUseV2(boolean flag)If set to true, every request that implementsV2RequestSupportwill be converted to a V2 API call
 
- 
- 
- 
Constructor Detail- 
SolrRequestpublic SolrRequest(SolrRequest.METHOD m, String path) 
 
- 
 - 
Method Detail- 
setUserPrincipalpublic void setUserPrincipal(Principal userPrincipal) 
 - 
getUserPrincipalpublic Principal getUserPrincipal() 
 - 
setUseV2public SolrRequest<T> setUseV2(boolean flag) If set to true, every request that implementsV2RequestSupportwill be converted to a V2 API call
 - 
setUseBinaryV2public SolrRequest<T> setUseBinaryV2(boolean flag) If set to true use javabin instead of json (default)
 - 
setPreferredNodespublic SolrRequest<T> setPreferredNodes(List<String> nodes) 
 - 
setBasicAuthCredentialspublic SolrRequest<T> setBasicAuthCredentials(String user, String password) 
 - 
getBasicAuthUserpublic String getBasicAuthUser() 
 - 
getBasicAuthPasswordpublic String getBasicAuthPassword() 
 - 
getMethodpublic SolrRequest.METHOD getMethod() 
 - 
setMethodpublic void setMethod(SolrRequest.METHOD method) 
 - 
getPathpublic String getPath() 
 - 
setPathpublic void setPath(String path) 
 - 
getResponseParserpublic ResponseParser getResponseParser() - Returns:
- The ResponseParser
 
 - 
setResponseParserpublic void setResponseParser(ResponseParser responseParser) Optionally specify how the Response should be parsed. Not all server implementations require a ResponseParser to be specified.- Parameters:
- responseParser- The- ResponseParser
 
 - 
getStreamingResponseCallbackpublic StreamingResponseCallback getStreamingResponseCallback() 
 - 
setStreamingResponseCallbackpublic void setStreamingResponseCallback(StreamingResponseCallback callback) 
 - 
getQueryParamspublic Set<String> getQueryParams() Parameter keys that are sent via the query string
 - 
getRequestTypepublic abstract String getRequestType() This method defines the type of this Solr request.
 - 
getParamspublic abstract SolrParams getParams() 
 - 
getContentStreams@Deprecated public Collection<ContentStream> getContentStreams() throws IOException Deprecated.Please usegetContentWriter(String)instead.- Throws:
- IOException
 
 - 
getContentWriterpublic RequestWriter.ContentWriter getContentWriter(String expectedType) If a request object wants to do a push write, implement this method.- Parameters:
- expectedType- This is the type that the RequestWriter would like to get. But, it is OK to send any format
 
 - 
createResponseprotected abstract T createResponse(SolrClient client) Create a new SolrResponse to hold the response from the server- Parameters:
- client- the- SolrClientthe request will be sent to
 
 - 
processpublic final T process(SolrClient client, String collection) throws SolrServerException, IOException Send this request to aSolrClientand return the response- Parameters:
- client- the SolrClient to communicate with
- collection- the collection to execute the request against
- Returns:
- the response
- Throws:
- SolrServerException- if there is an error on the Solr server
- IOException- if there is a communication error
 
 - 
processpublic final T process(SolrClient client) throws SolrServerException, IOException Send this request to aSolrClientand return the response- Parameters:
- client- the SolrClient to communicate with
- Returns:
- the response
- Throws:
- SolrServerException- if there is an error on the Solr server
- IOException- if there is a communication error
 
 - 
getCollectionpublic String getCollection() 
 - 
setBasePathpublic void setBasePath(String path) 
 - 
getBasePathpublic String getBasePath() 
 
- 
 
-