code: private void writeResp(ServletResponse response, SolrQueryRequest queryRequest, SolrQueryResponse queryResponse)
      throws IOException, UnsupportedEncodingException {
  
          if (m_solr instanceof EmbeddedSolrServer) {
              SolrCore core = ((EmbeddedSolrServer)m_solr).getCoreContainer().getCore(getCoreName());
              Writer out = null;
              try {
                  QueryResponseWriter responseWriter = core.getQueryResponseWriter(queryRequest);
  
                  final String ct = responseWriter.getContentType(queryRequest, queryResponse);
                  if (null != ct) {
                      response.setContentType(ct);
                  }
  
                  if (responseWriter instanceof BinaryQueryResponseWriter) {
                      BinaryQueryResponseWriter binWriter = (BinaryQueryResponseWriter)responseWriter;
                      binWriter.write(response.getOutputStream(), queryRequest, queryResponse);
                  } else {
                      String charset = ContentStreamBase.getCharsetFromContentType(ct);
                      out = ((charset == null) || charset.equalsIgnoreCase(UTF8.toString()))
                      ? new OutputStreamWriter(response.getOutputStream(), UTF8)
                      : new OutputStreamWriter(response.getOutputStream(), charset);
                      out = new FastWriter(out);
                      responseWriter.write(out, queryRequest, queryResponse);
                      out.flush();
                  }
              } finally {
                  core.close();
                  if (out != null) {
                      out.close();
                  }
              }
          } else {
              throw new UnsupportedOperationException();
          }
      }
docs: Writes the Solr response.<p>
  
  @param response the servlet response
  @param queryRequest the Solr request
  @param queryResponse the Solr response to write
  
  @throws IOException if sth. goes wrong
  @throws UnsupportedEncodingException if sth. goes wrong