: > So to understand better:
: >
: > user request -> micro-plugin -> RequestHandler -> ResponseHandler

: or:
:
: HttpServletRequest -> SolrRequestParser -> SolrRequestProcessor ->
: SolrResponse -> SolrResponseWriter


specifically what i had in mind was something like this...

  class SolrUberServlet extends HttpServlet {
    public service(HttpServletRequest req, HttpServletResponse response) {
      SolrCore core = getCore();
      Solr(Query)Response solrRsp = new Solr(Query)Response();

      // servlet specific method which does minimal inspection of
      // req to determine the parser name
      String p = pickRequestParser(req);

      // looks up a registered instance (from solrconfig.xml)
      // matching that name
      RequestParser solrParser = coreGetParserByName(p);

      // RequestParser is the only plugin class that knows about
      // HttpServletRequest, it builds up the SolrRequest (aka
      // SolrQueryRequest) which contains the SolrParams and streams
      SolrRequest solrReq = solrParser.parse(req);

      // does exactly what it does now: picks the RequestHandler to
      // use based on the params, calls it's handleRequest method
      core.execute(solrReq, solrRsp)

      // the rest of this is cut/paste from the current SolrServlet.
      // use SolrParams to pick OutputWriter name, ask core for instance,
      // have that writer write the results.
      QueryResponseWriter responseWriter = core.getQueryResponseWriter(solrReq);
      response.setContentType(responseWriter.getContentType(solrReq, solrRsp));
      PrintWriter out = response.getWriter();
      responseWriter.write(out, solrReq, solrRsp);

    }
  }


-Hoss

Reply via email to