本文整理汇总了Java中org.apache.solr.handler.RequestHandlerBase类的典型用法代码示例。如果您正苦于以下问题:Java RequestHandlerBase类的具体用法?Java RequestHandlerBase怎么用?Java RequestHandlerBase使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RequestHandlerBase类属于org.apache.solr.handler包,在下文中一共展示了RequestHandlerBase类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getHandlerName
import org.apache.solr.handler.RequestHandlerBase; //导入依赖的package包/类
protected static <T extends RequestHandlerBase> String getHandlerName(SolrCore core, String defaultName, Class<T> clz) {
//I'd be just as happy stripping this off the url if I could figure out how...
SolrRequestHandler handler = core.getRequestHandler(defaultName);
if (handler == null) {
for (Entry<String, ? extends RequestHandlerBase> kv : core.getRequestHandlers(clz).entrySet())
return kv.getKey();
} else
return defaultName;
return null;
}
示例2: verifyAuthorized
import org.apache.solr.handler.RequestHandlerBase; //导入依赖的package包/类
private void verifyAuthorized(RequestHandlerBase handler, String collection, String user) throws Exception {
SolrQueryRequest req = getRequest();
prepareCollAndUser(core, req, collection, user, false);
// just ensure we don't get an unauthorized exception
try {
handler.handleRequestBody(req, new SolrQueryResponse());
} catch (SolrException ex) {
assertFalse(ex.code() == SolrException.ErrorCode.UNAUTHORIZED.code);
} catch (Throwable t) {
// okay, we only want to verify we didn't get an Unauthorized exception,
// going to treat each handler as a black box.
}
}
示例3: verifyUnauthorized
import org.apache.solr.handler.RequestHandlerBase; //导入依赖的package包/类
private void verifyUnauthorized(RequestHandlerBase handler,
String collection, String user, boolean shouldFailAdmin) throws Exception {
String exMsgContains = "User " + user + " does not have privileges for " + (shouldFailAdmin?"admin":collection);
SolrQueryRequest req = getRequest();
prepareCollAndUser(core, req, collection, user, false);
try {
handler.handleRequestBody(req, new SolrQueryResponse());
Assert.fail("Expected SolrException");
} catch (SolrException ex) {
assertEquals(ex.code(), SolrException.ErrorCode.UNAUTHORIZED.code);
assertTrue(ex.getMessage().contains(exMsgContains));
}
}
示例4: verifyQueryAccess
import org.apache.solr.handler.RequestHandlerBase; //导入依赖的package包/类
private void verifyQueryAccess(RequestHandlerBase handler, boolean checkCollection) throws Exception {
verifyAuthorized(handler, "collection1", "junit");
verifyAuthorized(handler, "queryCollection", "junit");
if (checkCollection) {
verifyUnauthorized(handler, "bogusCollection", "junit", false);
verifyUnauthorized(handler, "updateCollection", "junit", false);
} else {
verifyUnauthorized(handler, "collection1", "bogusUser", true);
}
}
示例5: verifyQueryUpdateAccess
import org.apache.solr.handler.RequestHandlerBase; //导入依赖的package包/类
private void verifyQueryUpdateAccess(String path, boolean checkCollection) throws Exception {
RequestHandlerBase handler =
(RequestHandlerBase)core.getRequestHandlers().get(path);
verifyAuthorized(handler, "collection1", "junit");
verifyUnauthorized(handler, "collection1", "bogusUser", true);
if (checkCollection) {
verifyUnauthorized(handler, "queryCollection", "junit", false);
verifyUnauthorized(handler, "bogusCollection", "junit", false);
verifyUnauthorized(handler, "updateCollection", "junit", false);
}
}
示例6: verifyFile
import org.apache.solr.handler.RequestHandlerBase; //导入依赖的package包/类
private void verifyFile() throws Exception {
// file handler is built-in for backwards compatibility reasons. Thus,
// handler will not be secure, so let's create one to test.
String path = "/admin/file";
RequestHandlerBase handler = (RequestHandlerBase)core.getRequestHandlers().get(path);
assertFalse(handler instanceof SecureAdminHandlers.SecureShowFileRequestHandler);
handler = new SecureAdminHandlers.SecureShowFileRequestHandler();
verifyQueryAccess(handler, true);
}
示例7: verifyAuthorized
import org.apache.solr.handler.RequestHandlerBase; //导入依赖的package包/类
protected void verifyAuthorized(RequestHandlerBase handlerBase,
SolrQueryRequest req) throws Exception {
verifyAuthorized(null, handlerBase, req);
}
示例8: verifyUnauthorized
import org.apache.solr.handler.RequestHandlerBase; //导入依赖的package包/类
protected void verifyUnauthorized(RequestHandlerBase handlerBase,
SolrQueryRequest req, String collection, String user, boolean shouldFailAdmin) throws Exception {
verifyUnauthorized(null, handlerBase, req, collection, user, shouldFailAdmin);
}