use of org.apache.solr.handler.RequestHandlerBase in project lucene-solr by apache.
the class InfoHandler method handle.
private void handle(SolrQueryRequest req, SolrQueryResponse rsp, String path) {
int i = path.lastIndexOf('/');
String name = path.substring(i + 1, path.length());
RequestHandlerBase handler = handlers.get(name.toLowerCase(Locale.ROOT));
if (handler == null) {
throw new SolrException(SolrException.ErrorCode.NOT_FOUND, "No handler by name " + name + " available names are " + handlers.keySet());
}
handler.handleRequest(req, rsp);
rsp.setHttpCaching(false);
}
use of org.apache.solr.handler.RequestHandlerBase in project lucene-solr by apache.
the class BasicFunctionalityTest method testRequestHandlerBaseException.
@Test
public void testRequestHandlerBaseException() {
final String tmp = "BOO! ignore_exception";
SolrRequestHandler handler = new RequestHandlerBase() {
@Override
public String getDescription() {
return tmp;
}
@Override
public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) {
throw new RuntimeException(tmp);
}
};
handler.init(new NamedList());
SolrQueryResponse rsp = new SolrQueryResponse();
SolrQueryRequest req = req();
h.getCore().execute(handler, req, rsp);
assertNotNull("should have found an exception", rsp.getException());
req.close();
}
Aggregations