lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hoss Man (JIRA)" <>
Subject [jira] Resolved: (SOLR-1944) Add HttpServletRequest and HttpServletResponse to SolrQueryRequest and SolrQueryResponse
Date Mon, 23 Aug 2010 18:58:17 GMT


Hoss Man resolved SOLR-1944.

    Resolution: Duplicate

Even though this issue is older, i'm going to mark it as a Dup of SOLR-2079 since that issue
already has several comments

> Add HttpServletRequest and HttpServletResponse to SolrQueryRequest and SolrQueryResponse
> ----------------------------------------------------------------------------------------
>                 Key: SOLR-1944
>                 URL:
>             Project: Solr
>          Issue Type: New Feature
>    Affects Versions: 1.4
>            Reporter: Adam Brown
>            Priority: Minor
>         Attachments: HttpServletRequest.patch
> I am implementing several custom request handlers and response writers. All of them need
access to HTTP headers and cookies. In scanning google for mailing lists and forums it seems
others have had this same need.
> I worked around it by creating a custom dispatch filter which extends SolrDispatchFilter
and does the following:
> {code}
>   public static final String CONTEXT_SERVLET_REQUEST = "servletRequest";
>   public static final String CONTEXT_SERVLET_RESPONSE = "servletResponse";
>   @Override
>   public void doFilter(ServletRequest request, ServletResponse response, FilterChain
chain) throws IOException, ServletException {
>     request.setAttribute("response", response);
>     super.doFilter(request, response, chain);
>   }
>   @Override
>   protected void execute(HttpServletRequest servletRequest, SolrRequestHandler handler,
SolrQueryRequest solrRequest, SolrQueryResponse solrResponse) {
>     Object servletResponse = servletRequest.getAttribute("response");
>     servletRequest.removeAttribute("response");
>     solrRequest.getContext().put(CONTEXT_SERVLET_REQUEST, servletRequest);
>     solrRequest.getContext().put(CONTEXT_SERVLET_RESPONSE, servletResponse);
>     super.execute(servletRequest, handler, solrRequest, solrResponse);
>   }
> {code}
> I then had to write a step in my deployment script to crack open the solr war file, sed
the web.xml and replace the SolrDispatchFilter with my own. Others have worked around the
issue in the same way. This seems like an ugly workaround and would be simpler and cleaner
if the SolrQueryRequest and SolrQueryResponse just included a reference to their http counterparts.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message