Larry,
The recommended way to construct an SOLRJ HttpSolrClient is via the
HttpSolrClient.Builder class. The Builder shields the client from any and all
access to the Apache HttpClient. So I have created a new replacement for the
HttpSolrClient.Builder class which basically bootstraps the header information
to include basic authentication information.
For normal GET operations the normal challenge response mechanism would work.
If we do a POST operation, the SOLRJ API will refuse to retry the operation
since it could cause duplicate records to be created, etc. Hence the need for
the preemptive authentication to prevent the failure.
Usage would be as follows:
SolrClient client = new PreemptiveHttpSolrClient.Builder()
.withBaseSolrURL("https://host:8443/gateway/solr/core1")
.withPreemptiveBasicAuthCredentials("user","pwd")
.build();
Yes it should be a replacement for HttpClient within KnoxShell with appropriate
credentials.
I have attached the Builder class.
Hope that helps clarify the matter.
Rick
-----Original Message-----
From: larry mccay [mailto:[email protected]]
Sent: Friday, September 22, 2017 3:38 PM
To: [email protected]
Subject: Re: Java Client Examples
Hi Rick -
This is an interesting question.
Unfortunately, I think that I need more information here.
I may need to see the client you are talking about and a sample of its use to
understand properly.
Is this a drop-in replacement for the HttpClient being used in KnoxShell?
thanks,
--larry
On Fri, Sep 22, 2017 at 2:58 PM, Rick Kellogg <[email protected]> wrote:
> Greetings,
>
>
>
> When using Knox against SOLR for any operation that requires a POST
> HTTP action, the standard authentication mechanism in SOLRJ does not function.
> The default challenge/response mechanism specifically prevents the
> replay of operations. As such I have had to construct a
> HttpSolrClient that uses preauthentication.
>
>
>
> Question: How to we provide this to our intended Knox users? Do we
> want to create another Knox project with sample clients showing
> authentication bootstrap? Or potentially individual projects for different
> services?
>
>
>
> Thoughts?
>
> Rick Kellogg
>
>
>
>