manifoldcf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Karl Wright <daddy...@gmail.com>
Subject Re: How are you supposed to send multipart form requests using SolrJ now?
Date Fri, 21 Sep 2018 15:43:45 GMT
I should also mention that Solr Cell makes use of the multipart form's
separator name.  This functionality seems to be unavailable through the
URL.  We have a number of clients who rely on this.

Karl


On Fri, Sep 21, 2018 at 10:15 AM Karl Wright <daddywri@gmail.com> wrote:

> Hi all,
>
> With the release of 7.4, several things changed inside Solrj.  One
> critical thing that changed was that it now seems to be impossible to send
> POST requests with multipart form encoding.  This functionality is critical
> to ManifoldCF since the metadata it sends to Solr regularly exceeds URL
> length.  Here's a snippet of (modified) code from HttpSolrClient:
>
> >>>>>>
>       if(contentWriter != null) {
>         String fullQueryUrl = url + toQueryString(wparams, false);
>         HttpEntityEnclosingRequestBase postOrPut = SolrRequest.METHOD.POST
> == request.getMethod() ?
>             new HttpPost(fullQueryUrl) : new HttpPut(fullQueryUrl);
>         System.out.println("Content type is
> "+contentWriter.getContentType());
>         postOrPut.addHeader("Content-Type",
>             contentWriter.getContentType());
>         postOrPut.setEntity(new BasicHttpEntity(){
>           @Override
>           public boolean isStreaming() {
>             return true;
>           }
>
>           @Override
>           public void writeTo(OutputStream outstream) throws IOException {
>             contentWriter.write(outstream);
>           }
>         });
>         return postOrPut;
> <<<<<<
>
> This takes over all transmissions of POST requests, in practice, and
> transmits them as application/octet-stream, with metadata on the URL.
> There's no way to override this; while I can instead used the multipart
> stuff consistently, when I do so the request to delete a document fails,
> with this SolrJ stack trace:
>
> >>>>>>
> FATAL 2018-09-21T09:54:58,362 (Document delete thread '4') - Error tossed:
> This Should not happen
> java.lang.RuntimeException: This Should not happen
>         at
> org.apache.solr.client.solrj.impl.BinaryRequestWriter.getContentStreams(BinaryRequestWriter.java:67)
> ~[solr-solrj-7.4.0.jar:7.4.0 9060ac689c270b02143f375de0348b7f626adebc -
> jpountz - 2018-06-18 16:55:14]
>         at
> org.apache.manifoldcf.agents.output.solr.ModifiedHttpSolrClient.createMethod(ModifiedHttpSolrClient.java:148)
> ~[classes/:?]
>         at
> org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient.java:253)
> ~[solr-solrj-7.4.0.jar:7.4.0 9060ac689c270b02143f375de0348b7f626adebc -
> jpountz - 2018-06-18 16:55:14]
>         at
> org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient.java:244)
> ~[solr-solrj-7.4.0.jar:7.4.0 9060ac689c270b02143f375de0348b7f626adebc -
> jpountz - 2018-06-18 16:55:14]
>         at
> org.apache.solr.client.solrj.SolrRequest.process(SolrRequest.java:194)
> ~[solr-solrj-7.4.0.jar:7.4.0 9060ac689c270b02143f375de0348b7f626adebc -
> jpountz - 2018-06-18 16:55:14]
>         at
> org.apache.solr.client.solrj.SolrRequest.process(SolrRequest.java:211)
> ~[solr-solrj-7.4.0.jar:7.4.0 9060ac689c270b02143f375de0348b7f626adebc -
> jpountz - 2018-06-18 16:55:14]
>         at
> org.apache.manifoldcf.agents.output.solr.HttpPoster$DeleteThread.run(HttpPoster.java:1364)
> ~[classes/:?]
> <<<<<<
>
> Any ideas?
>
> Karl
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message