In Solr, RequestHandler are called from a specific core.
But, there is many cases where we want to have more information from other cores.

The easist way is to get this information directly from the the request parameter. Indeed, in your handleRequestBody:

  1. @Override
  2. public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throws Exception {

Get your current core.

  1. final SolrCore core = req.getCore();

Retrieve CoreContainer using core object.
CoreContainer contain all cores, so, can be used easily to get all cores.

  1. final Collection<SolrCore> cores = core.getCoreDescriptor().getCoreContainer().getCores();

A loop can be used to display our cores.

  1. for (SolrCore solrCore : cores) {
  3. }

😉 you can call a get to retrieve a specific core

  1. SolrCore core1 = core.getCoreDescriptor().getCoreContainer().getCore("core1");

Update : Don’t forget to close your core after exploitation with core.close()