Re: Access HTTP headers from custom request handler
Hello Hoss, thank you for your reply. I have no problems subclassing the SolrDispatchFilter...but where shall I configure it? :-) I cannot find any doc/wiki explaining how to configure a custom dispatch filter. I believe it should be in solrconfig.xml requestDispatcher ... ... /requestDispatcher Any idea? Is there a schema for solrconfig.xml? It would make my life easier... ;-) Thanks, Giovanni On Wed, Apr 15, 2009 at 12:48 AM, Chris Hostetter hossman_luc...@fucit.orgwrote: : Solr cannot assume that the request would always come from http (think : of EmbeddedSolrServer) .So it assumes that there are only parameters exactly. : Your best bet is to modify SolrDispatchFilter and readthe params and : set them in the SolrRequest Object SolrDispatchFilter is designed to be subclassed to make this easy by overriding the execute method... protected void execute( HttpServletRequest req, SolrRequestHandler handler, SolrQueryRequest sreq, SolrQueryResponse rsp) { sreq.getContext().put( HttpServletRequest, req ); super.execute( req, handler, sreq, rsp ) } -Hoss
Re: Access HTTP headers from custom request handler
nope. you must edit the web.xml and register the filter there On Thu, Apr 23, 2009 at 3:45 PM, Giovanni De Stefano giovanni.destef...@gmail.com wrote: Hello Hoss, thank you for your reply. I have no problems subclassing the SolrDispatchFilter...but where shall I configure it? :-) I cannot find any doc/wiki explaining how to configure a custom dispatch filter. I believe it should be in solrconfig.xml requestDispatcher ... ... /requestDispatcher Any idea? Is there a schema for solrconfig.xml? It would make my life easier... ;-) Thanks, Giovanni On Wed, Apr 15, 2009 at 12:48 AM, Chris Hostetter hossman_luc...@fucit.orgwrote: : Solr cannot assume that the request would always come from http (think : of EmbeddedSolrServer) .So it assumes that there are only parameters exactly. : Your best bet is to modify SolrDispatchFilter and readthe params and : set them in the SolrRequest Object SolrDispatchFilter is designed to be subclassed to make this easy by overriding the execute method... protected void execute( HttpServletRequest req, SolrRequestHandler handler, SolrQueryRequest sreq, SolrQueryResponse rsp) { sreq.getContext().put( HttpServletRequest, req ); super.execute( req, handler, sreq, rsp ) } -Hoss -- --Noble Paul
Re: Access HTTP headers from custom request handler
Right, you will have to build a new war with your own subclass of SolrDispatchFilter *rather* then using the packaged one. On Apr 23, 2009, at 12:34 PM, Noble Paul നോബിള് नोब्ळ् wrote: nope. you must edit the web.xml and register the filter there On Thu, Apr 23, 2009 at 3:45 PM, Giovanni De Stefano giovanni.destef...@gmail.com wrote: Hello Hoss, thank you for your reply. I have no problems subclassing the SolrDispatchFilter...but where shall I configure it? :-) I cannot find any doc/wiki explaining how to configure a custom dispatch filter. I believe it should be in solrconfig.xml requestDispatcher ... ... /requestDispatcher Any idea? Is there a schema for solrconfig.xml? It would make my life easier... ;-) Thanks, Giovanni On Wed, Apr 15, 2009 at 12:48 AM, Chris Hostetter hossman_luc...@fucit.orgwrote: : Solr cannot assume that the request would always come from http (think : of EmbeddedSolrServer) .So it assumes that there are only parameters exactly. : Your best bet is to modify SolrDispatchFilter and readthe params and : set them in the SolrRequest Object SolrDispatchFilter is designed to be subclassed to make this easy by overriding the execute method... protected void execute( HttpServletRequest req, SolrRequestHandler handler, SolrQueryRequest sreq, SolrQueryResponse rsp) { sreq.getContext().put( HttpServletRequest, req ); super.execute( req, handler, sreq, rsp ) } -Hoss -- --Noble Paul
Re: Access HTTP headers from custom request handler
: Solr cannot assume that the request would always come from http (think : of EmbeddedSolrServer) .So it assumes that there are only parameters exactly. : Your best bet is to modify SolrDispatchFilter and readthe params and : set them in the SolrRequest Object SolrDispatchFilter is designed to be subclassed to make this easy by overriding the execute method... protected void execute( HttpServletRequest req, SolrRequestHandler handler, SolrQueryRequest sreq, SolrQueryResponse rsp) { sreq.getContext().put( HttpServletRequest, req ); super.execute( req, handler, sreq, rsp ) } -Hoss
Access HTTP headers from custom request handler
Hello all, we are writing a custom request handler and we need to implement some business logic according to some HTTP headers. I see there is no easy way to access HTTP headers from the request handler. Moreover it seems to me that the HTTPServletness is lost way before the custom request handler comes in the game. Is there any way to access HTTP headers from within the request handler? Thanks, Giovanni