[ 
https://issues.apache.org/jira/browse/CONNECTORS-1564?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16735738#comment-16735738
 ] 

Erlend GarĂ¥sen commented on CONNECTORS-1564:
--------------------------------------------

{quote}Could you please ask the contributor if he has considered using
 AuthCache to implement preemptive BASIC authentication as described
 here?
{quote}
I'm afraid this is more complicated to implement since we are using SolrJ. 
HttpSolrServer's constructor takes basically two parameters, a URL and a 
HttpClient. I tried to implement the code example in another project using 
SolrJ, but the tricky part was to add a required HttpClientContext.

Maybe there are solutions to that, but the short answer is that adding an 
interceptor was quite easy. And the interceptor class might be useful for other 
output connectors.

Regarding the expect 100-continue approach. We implemented this for some years 
ago as far as I remember. And it seems that we have implemented it in our 
RequestConfig (in the class HttpPoster):

{{.setExpectContinueEnabled(true)}}

The whole idea behind the contribution was to get around the following 
exception:

{{org.apache.http.client.NonRepeatableRequestException: Cannot}}
{{retry request with a non-repeatable request entity.}}

So at the moment, I'm not sure whether posting to a Solr server with basic 
authentication works in the latest MCF version. I would appreciate if someone 
else could verify this. Regardless of preemptive authentication is a correct 
way to get around the exception, I still think it's a good idea in order to 
post documents more efficiently.

> Support preemptive authentication to Solr connector
> ---------------------------------------------------
>
>                 Key: CONNECTORS-1564
>                 URL: https://issues.apache.org/jira/browse/CONNECTORS-1564
>             Project: ManifoldCF
>          Issue Type: Improvement
>          Components: Lucene/SOLR connector
>            Reporter: Erlend GarĂ¥sen
>            Assignee: Karl Wright
>            Priority: Major
>         Attachments: CONNECTORS-1564.patch
>
>
> We should post preemptively in case the Solr server requires basic 
> authentication. This will make the communication between ManifoldCF and Solr 
> much more effective instead of the following:
>  * Send a HTTP POST request to Solr
>  * Solr sends a 401 response
>  * Send the same request, but with a "{{Authorization: Basic}}" header
> With preemptive authentication, we can send the header in the first request.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to