当前位置: 首页>>代码示例>>Java>>正文


Java RequestHandlerBase类代码示例

本文整理汇总了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;
}
 
开发者ID:tballison,项目名称:lucene-addons,代码行数:13,代码来源:SolrConcordanceBase.java

示例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.
  }
}
 
开发者ID:apache,项目名称:incubator-sentry,代码行数:14,代码来源:SecureAdminHandlersTest.java

示例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));
  }
}
 
开发者ID:apache,项目名称:incubator-sentry,代码行数:14,代码来源:SecureAdminHandlersTest.java

示例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);
  }
}
 
开发者ID:apache,项目名称:incubator-sentry,代码行数:11,代码来源:SecureAdminHandlersTest.java

示例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);
  }
}
 
开发者ID:apache,项目名称:incubator-sentry,代码行数:12,代码来源:SecureAdminHandlersTest.java

示例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);
}
 
开发者ID:apache,项目名称:incubator-sentry,代码行数:10,代码来源:SecureAdminHandlersTest.java

示例7: verifyAuthorized

import org.apache.solr.handler.RequestHandlerBase; //导入依赖的package包/类
protected void verifyAuthorized(RequestHandlerBase handlerBase,
    SolrQueryRequest req) throws Exception {
  verifyAuthorized(null, handlerBase, req);
}
 
开发者ID:apache,项目名称:incubator-sentry,代码行数:5,代码来源:SentryTestBase.java

示例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);
}
 
开发者ID:apache,项目名称:incubator-sentry,代码行数:5,代码来源:SentryTestBase.java


注:本文中的org.apache.solr.handler.RequestHandlerBase类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。