lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adam Brown (JIRA)" <j...@apache.org>
Subject [jira] Created: (SOLR-1944) Add HttpServletRequest and HttpServletResponse to SolrQueryRequest and SolrQueryResponse
Date Wed, 09 Jun 2010 16:36:14 GMT
Add HttpServletRequest and HttpServletResponse to SolrQueryRequest and SolrQueryResponse
----------------------------------------------------------------------------------------

                 Key: SOLR-1944
                 URL: https://issues.apache.org/jira/browse/SOLR-1944
             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: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Mime
View raw message