Search in sources :

Example 1 with ConfigSetAction

use of org.apache.solr.common.params.ConfigSetParams.ConfigSetAction in project lucene-solr by apache.

the class ConfigSetsHandler method handleRequestBody.

@Override
public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throws Exception {
    if (coreContainer == null) {
        throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "Core container instance missing");
    }
    // Make sure that the core is ZKAware
    if (!coreContainer.isZooKeeperAware()) {
        throw new SolrException(ErrorCode.BAD_REQUEST, "Solr instance is not running in SolrCloud mode.");
    }
    // Pick the action
    SolrParams params = req.getParams();
    String a = params.get(ConfigSetParams.ACTION);
    if (a != null) {
        ConfigSetAction action = ConfigSetAction.get(a);
        if (action == null)
            throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "Unknown action: " + a);
        if (action == ConfigSetAction.UPLOAD) {
            handleConfigUploadRequest(req, rsp);
            return;
        }
        invokeAction(req, rsp, action);
    } else {
        throw new SolrException(ErrorCode.BAD_REQUEST, "action is a required param");
    }
    rsp.setHttpCaching(false);
}
Also used : ConfigSetAction(org.apache.solr.common.params.ConfigSetParams.ConfigSetAction) SolrParams(org.apache.solr.common.params.SolrParams) SolrException(org.apache.solr.common.SolrException)

Aggregations

SolrException (org.apache.solr.common.SolrException)1 ConfigSetAction (org.apache.solr.common.params.ConfigSetParams.ConfigSetAction)1 SolrParams (org.apache.solr.common.params.SolrParams)1