lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shawn Heisey <>
Subject Re: Cookies with SOLRJ?
Date Fri, 04 Aug 2017 22:38:07 GMT
On 8/4/2017 8:59 AM, Sanders, Marshall (CAI - Atlanta) wrote:
> Is there a way to easily set/get a cookie from a solrj request/response or an example
of this someone can share?
> The types of queries our application uses could greatly benefit from stickying our application
to a specific solr instance and I'd like to read the load balancer cookie and then send it
with subsequent requests.  This would mostly just be used for /select get queries, not updates
or anything like that if it makes a difference.

SolrJ (4.0 and later) uses the HttpClient library from Apache
HttpComponents.  It does not expose much of that library's configuration

There is an 8 year old thread from this list with a similar question:

The beginning of the response from Chris Hostetter on 2009-08-21 sounds
like HttpClient might manage cookies for you, so you can try the idea below.

You can create a custom HttpClient object that can be used to build your
solr client object, and give that object the cookie policy you want it
to have, but I do not know if SolrJ is coded in a way that would
actually use any cookies received.

See section 3.3 on this page for information on how to build a custom
HttpClient object with a particular cookie policy:

I do see that there is code in the BasicHttpSolrClientTest class for
cookies, but I do not know what that code is doing.

If SolrJ does not currently have the ability to do this, it would be an
excellent feature request to open in Jira.

I'm just guessing here.  I really have no idea whether any of what I
said above will be helpful.


View raw message