solr - How to get the raw binary content in Grails controller -


after many days of search , many unsuccessful tries, hope community knows way achieve task:

i want use grails kind of proxy solr backend. this, want ensure authorized requests handled solr. grails checks provided collection , requested action , validated request predefined user based rules. therefore, extended grails url mapping to

"/documents/$collection/$query" {     controller = "documents"     action = action = [get: "proxy_get", post: "proxy_post"] } 

the proxy_get method works fine when client using solrj. have to forward url request solr , reply solr response.

however, in proxy_post method, need raw body data of request forward solr. solrj using javabin , not able far raw binary request. promising approach this:

defaulthttpclient httpclient = new defaulthttpclient(); httppost httppost = new httppost(solrurl); inputstream requeststream = request.getinputstream(); contenttype contenttype = contenttype.create(request.getcontenttype()); httppost.setentity(new bytearrayentity(ioutils.tobytearray(requeststream), contenttype)); httppost.setheader("content-type", request.getcontenttype()) httpresponse solrresponse = httpclient.execute(httppost); 

however, transferred content empty in case of javabin (e.g. when add document using solrj).

so question is, whether there possibility raw binary post content can forward request solr.

mathias

try using groovy httpbuilder. has powerful low-level api, while providing groovyness


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -