You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Hoss Man (JIRA)" <ji...@apache.org> on 2010/08/23 20:58:17 UTC

[jira] Resolved: (SOLR-1944) Add HttpServletRequest and HttpServletResponse to SolrQueryRequest and SolrQueryResponse

     [ https://issues.apache.org/jira/browse/SOLR-1944?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

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: 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