public abstract class SolrRequest<T extends SolrResponse> extends Object implements Serializable
Modifier and Type | Class and Description |
---|---|
static class |
SolrRequest.METHOD |
Modifier and Type | Field and Description |
---|---|
static Set<String> |
SUPPORTED_METHODS |
protected boolean |
useBinaryV2 |
protected boolean |
usev2 |
Constructor and Description |
---|
SolrRequest(SolrRequest.METHOD m,
String path) |
Modifier and Type | Method and Description |
---|---|
void |
addHeader(String key,
String value) |
protected abstract T |
createResponse(SolrClient client)
Create a new SolrResponse to hold the response from the server
|
String |
getBasePath() |
String |
getBasicAuthPassword() |
String |
getBasicAuthUser() |
String |
getCollection() |
Collection<ContentStream> |
getContentStreams()
Deprecated.
Please use
getContentWriter(String) instead. |
RequestWriter.ContentWriter |
getContentWriter(String expectedType)
If a request object wants to do a push write, implement this method.
|
Map<String,String> |
getHeaders() |
SolrRequest.METHOD |
getMethod() |
abstract SolrParams |
getParams() |
String |
getPath() |
Set<String> |
getQueryParams()
Parameter keys that are sent via the query string
|
ResponseParser |
getResponseParser() |
StreamingResponseCallback |
getStreamingResponseCallback() |
Principal |
getUserPrincipal() |
T |
process(SolrClient client)
Send this request to a
SolrClient and return the response |
T |
process(SolrClient client,
String collection)
Send this request to a
SolrClient and return the response |
void |
setBasePath(String path) |
SolrRequest |
setBasicAuthCredentials(String user,
String password) |
void |
setMethod(SolrRequest.METHOD method) |
void |
setPath(String path) |
void |
setQueryParams(Set<String> queryParams) |
void |
setResponseParser(ResponseParser responseParser)
Optionally specify how the Response should be parsed.
|
void |
setStreamingResponseCallback(StreamingResponseCallback callback) |
SolrRequest |
setUseBinaryV2(boolean flag)
If set to true use javabin instead of json (default)
|
void |
setUserPrincipal(Principal userPrincipal) |
SolrRequest |
setUseV2(boolean flag)
If set to true, every request that implements
V2RequestSupport will be converted
to a V2 API call |
public SolrRequest(SolrRequest.METHOD m, String path)
public void setUserPrincipal(Principal userPrincipal)
public Principal getUserPrincipal()
public SolrRequest setUseV2(boolean flag)
V2RequestSupport
will be converted
to a V2 API callpublic SolrRequest setUseBinaryV2(boolean flag)
public SolrRequest setBasicAuthCredentials(String user, String password)
public String getBasicAuthUser()
public String getBasicAuthPassword()
public SolrRequest.METHOD getMethod()
public void setMethod(SolrRequest.METHOD method)
public String getPath()
public void setPath(String path)
public ResponseParser getResponseParser()
ResponseParser
public void setResponseParser(ResponseParser responseParser)
responseParser
- The ResponseParser
public StreamingResponseCallback getStreamingResponseCallback()
public void setStreamingResponseCallback(StreamingResponseCallback callback)
public Set<String> getQueryParams()
public abstract SolrParams getParams()
@Deprecated public Collection<ContentStream> getContentStreams() throws IOException
getContentWriter(String)
instead.IOException
public RequestWriter.ContentWriter getContentWriter(String expectedType)
expectedType
- This is the type that the RequestWriter would like to get. But, it is OK to send any formatprotected abstract T createResponse(SolrClient client)
client
- the SolrClient
the request will be sent topublic final T process(SolrClient client, String collection) throws SolrServerException, IOException
SolrClient
and return the responseclient
- the SolrClient to communicate withcollection
- the collection to execute the request againstSolrServerException
- if there is an error on the Solr serverIOException
- if there is a communication errorpublic final T process(SolrClient client) throws SolrServerException, IOException
SolrClient
and return the responseclient
- the SolrClient to communicate withSolrServerException
- if there is an error on the Solr serverIOException
- if there is a communication errorpublic String getCollection()
public void setBasePath(String path)
public String getBasePath()
Copyright © 2000-2019 Apache Software Foundation. All Rights Reserved.