-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Dimitris,

On 6/1/18 02:46, Dimitris Kardarakos wrote:
> Thanks a lot Shawn. I had tried with the documented approach, but
> since I use SolrClient.add to add documents to the index, I could
> not "port" the documented approach to my case (probably I do miss
> something).
> 
> The custom HttpClient suggestion worked as expected!

Can you please explain how you did this?

I'm facing a problem where the simplest possible solution is giving
the error "org.apache.http.client.NonRepeatableRequestException:
Cannot retry request with a non-repeatable request entity.".

It seems that SolrClient is using something like BasicHttpEntity which
isn't "repeatable" when using HTTP Basic auth (where the server is
supposed to challenge the client and the client only then sends the
credentials). I need to either make the client data repeatable (which
is in SolrClient, which I'd prefer to avoid) or I need to make
HttpClient use an "expectant" credential-sending technique, or I need
to just stuff things into a header manually.

What did you do to solve this problem? It seems like this should
really probably come up more often than it does. Maybe nobody bothers
to lock-down their Solr instances?

Thanks,
- -chris

> On 31/05/2018 06:16 μμ, Shawn Heisey wrote:
>> On 5/31/2018 8:03 AM, Dimitris Kardarakos wrote:
>>> Following the feedback in the "Index protected zip" thread, I
>>> am trying to add documents to the index using SolrJ API.
>>> 
>>> The server is in SolrCloud mode with BasicAuthPlugin for
>>> authentication.
>>> 
>>> I have not managed to figure out how to pass username/password
>>> to my client.
>> There are two ways to approach this.
>> 
>> One approach is to build a custom HttpClient object that uses 
>> credentials by default, and then use that custom HttpClient
>> object to build your CloudSolrClient.  Exactly how to correctly
>> build the HttpClient object will depend on exactly which
>> HttpClient version you've included into your program.  If you go
>> with SolrJ dependency defaults, then the HttpClient version will
>> depend on the SolrJ version.
>> 
>> The other approach is the method described in the documentation,
>> where credentials are added to each request object:
>> 
>> https://lucene.apache.org/solr/guide/6_6/basic-authentication-plugin.
html#BasicAuthenticationPlugin-UsingBasicAuthwithSolrJ
>>
>>
>>
>> 
There are several different kinds of request objects.  A few examples:
>> UpdateRequest, QueryRequest, CollectionAdminRequest.
>> 
>> Thanks, Shawn
>> 
> 
-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlzxjlEACgkQHPApP6U8
pFhoeQ/7BzlhjGGE8tnMcrdmruP+N2rgvawfLcTdzDg3U4cQFNUVRoCclZcM8LiA
iuZf+cAewTTQTjLpQuSv2WoknQgO/YRgaqTlo+b3hv9zR2awY8Mob/m5RYcYAwmn
i+2SJrG7+u+qhpfDQGSjwppUKpm2WrfvGXL3lcRF48UXQ+z7J95o2g88SnP44FKH
87/X/iYX+xMsj0bkIEOkyppuXENQQwUZ7QWhgfAxSItJr2A0Ma6zkuuNPf4FvBJ1
JQM/c33WWbAXK3B7tI5iQsstVi5CMOhRF0Z336/vZgq6aF9uEZvIOWEVAlM+E8Qp
mYlZz7tERzUMs+QbcBcSdDIb8VSPwYy5kvKiJ9eEpjFGXmPBLOqiJ4M+4SOeGFq7
BA5sbm6k4gwHc33MiKvnHE1K+k3r1OBPngjxvelsyIaqSnX3zpKPTFhkU2dvWMPt
XPo/ICuiliGowD8xh5EhB6w0BuYZhK3dW7AKMCLbyoANwk7SLfHxC6O+rdmYyDQF
UwiR65+3ImmeKJOZt7lFoR43BXoFuz6L1SILU8XRcclS5KwXHg3moBElU7jM9iKV
9vMwWkuPGUA2gq5K0oV4XFEOShxUxFiCL4FXjd/P7x9Evhio+itvaUlHzP8FGblh
YyK+l2YqjKBnTJ0G4XE8UnJcmH8C23jJ05gwMgq92pXBQy5ly6s=
=6kab
-----END PGP SIGNATURE-----

Reply via email to