public void handleRequestBody()

in crossdc-producer/src/main/java/org/apache/solr/handler/admin/MirroringConfigSetsHandler.java [80:110]


  public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throws Exception {
    boolean doMirroring = req.getParams().getBool(CrossDcConstants.SHOULD_MIRROR, true);
    if (!doMirroring) {
      log.info(" -- doMirroring=false, skipping...");
      super.handleRequestBody(req, rsp);
      return;
    }
    // fully read all streams and re-package them so they are re-readable
    LocalSolrQueryRequest localReq = new LocalSolrQueryRequest(req.getCore(), req.getParams());
    List<ContentStream> contentStreams = null;
    if (req.getContentStreams() != null) {
      contentStreams = new ArrayList<>();
      for (ContentStream cs : req.getContentStreams()) {
        MirroredSolrRequest.ExposedByteArrayContentStream stream = MirroredSolrRequest.ExposedByteArrayContentStream.of(cs);
        contentStreams.add(stream);
      }
      localReq.setContentStreams(contentStreams);
    }
    // throw any errors before mirroring
    baseHandleRequestBody(localReq, rsp);

    if (rsp.getException() != null) {
      return;
    }
    if (sink == null) {
      return;
    }
    SolrRequest.METHOD method = SolrRequest.METHOD.valueOf(req.getHttpMethod().toUpperCase(Locale.ROOT));
    MirroredSolrRequest.MirroredConfigSetRequest configSetRequest = new MirroredSolrRequest.MirroredConfigSetRequest(method, req.getParams(), contentStreams);
    sink.submit(new MirroredSolrRequest(MirroredSolrRequest.Type.CONFIGSET, configSetRequest));
  }