You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Shawn Heisey <so...@elyograg.org> on 2013/06/03 23:06:36 UTC

How to set HTTP header on Solr response?

I'm hoping to add support for a download=true|on parameter to 
ShowFileRequestHandler.  I'm working with Stefan to add support to the 
UI for schema/config download links.  Something I can't figure out is 
how to request that specific HTTP headers be sent with the Solr 
response.  Is there already a mechanism to do this?

Thanks,
Shawn

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Re: How to set HTTP header on Solr response?

Posted by Tomás Fernández Löbbe <to...@gmail.com>.
I'm not sure which would be the best way to do this. The main concern on
SOLR-2079 was not make Solr or any of it built-in components depend
directly on http, as Solr can be used in other ways (although, as I don't
know much about Solr's UI, I'm not sure if this still applies here).
Maybe you could add this extra information to the SolrResponse, and then
move that to the HttpResponse headers in the writeResponse method of the
SolrDispatchFilter, in a similar way that Solr is doing today with the
exceptions.

Tomás


On Mon, Jun 3, 2013 at 7:09 PM, Shawn Heisey <so...@elyograg.org> wrote:

> On 6/3/2013 3:22 PM, Tomás Fernández Löbbe wrote:
>
>> I don't think that's possible now. I recently had a need to access the
>> request headers and there was no way to do it. I added a change to make
>> the original http request to be added to the SolrQueryRequest context
>> (SOLR-2079), but I don't think there is an option to do something
>> similar with the response at this point (at least from what I see in
>> SolrDispatchFilter).
>>
>
> Do you have any advice about how I might expose what I need without
> breaking anything?  Perhaps it might be simply a matter of including a
> NamedList with the headers/values that I need, similar to the way that the
> file content is included, and accessing that object at the point where the
> http response is built.  Any pointers about where to put this code would be
> awesome.
>
>
> Thanks,
> Shawn
>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.**org<de...@lucene.apache.org>
> For additional commands, e-mail: dev-help@lucene.apache.org
>
>

Re: How to set HTTP header on Solr response?

Posted by Shawn Heisey <so...@elyograg.org>.
On 6/3/2013 3:22 PM, Tomás Fernández Löbbe wrote:
> I don't think that's possible now. I recently had a need to access the
> request headers and there was no way to do it. I added a change to make
> the original http request to be added to the SolrQueryRequest context
> (SOLR-2079), but I don't think there is an option to do something
> similar with the response at this point (at least from what I see in
> SolrDispatchFilter).

Do you have any advice about how I might expose what I need without 
breaking anything?  Perhaps it might be simply a matter of including a 
NamedList with the headers/values that I need, similar to the way that 
the file content is included, and accessing that object at the point 
where the http response is built.  Any pointers about where to put this 
code would be awesome.

Thanks,
Shawn


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Re: How to set HTTP header on Solr response?

Posted by Tomás Fernández Löbbe <to...@gmail.com>.
I don't think that's possible now. I recently had a need to access the
request headers and there was no way to do it. I added a change to make the
original http request to be added to the SolrQueryRequest context
(SOLR-2079), but I don't think there is an option to do something similar
with the response at this point (at least from what I see in
SolrDispatchFilter).

Tomás


On Mon, Jun 3, 2013 at 6:06 PM, Shawn Heisey <so...@elyograg.org> wrote:

> I'm hoping to add support for a download=true|on parameter to
> ShowFileRequestHandler.  I'm working with Stefan to add support to the UI
> for schema/config download links.  Something I can't figure out is how to
> request that specific HTTP headers be sent with the Solr response.  Is
> there already a mechanism to do this?
>
> Thanks,
> Shawn
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.**org<de...@lucene.apache.org>
> For additional commands, e-mail: dev-help@lucene.apache.org
>
>