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


Java Method类代码示例

本文整理汇总了Java中org.elasticsearch.rest.RestRequest.Method的典型用法代码示例。如果您正苦于以下问题:Java Method类的具体用法?Java Method怎么用?Java Method使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Method类属于org.elasticsearch.rest.RestRequest包,在下文中一共展示了Method类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getEsMethod

import org.elasticsearch.rest.RestRequest.Method; //导入依赖的package包/类
private Method getEsMethod(final String method) {
    if ("get".equalsIgnoreCase(method)) {
        return Method.GET;
    } else if ("post".equalsIgnoreCase(method)) {
        return Method.POST;
    } else if ("put".equalsIgnoreCase(method)) {
        return Method.PUT;
    } else if ("delete".equalsIgnoreCase(method)) {
        return Method.DELETE;
    } else if ("options".equalsIgnoreCase(method)) {
        return Method.OPTIONS;
    } else if ("head".equalsIgnoreCase(method)) {
        return Method.HEAD;
    }
    return null;
}
 
开发者ID:codelibs,项目名称:elasticsearch-auth,代码行数:17,代码来源:LoginConstraint.java

示例2: createMethods

import org.elasticsearch.rest.RestRequest.Method; //导入依赖的package包/类
private Method[] createMethods(final String[] methodValues) {
    final List<Method> methodList = new ArrayList<Method>();
    for (final String method : methodValues) {
        if ("get".equalsIgnoreCase(method)) {
            methodList.add(Method.GET);
        } else if ("post".equalsIgnoreCase(method)) {
            methodList.add(Method.POST);
        } else if ("head".equalsIgnoreCase(method)) {
            methodList.add(Method.HEAD);
        } else if ("options".equalsIgnoreCase(method)) {
            methodList.add(Method.OPTIONS);
        } else if ("put".equalsIgnoreCase(method)) {
            methodList.add(Method.PUT);
        } else if ("delete".equalsIgnoreCase(method)) {
            methodList.add(Method.DELETE);
        }
    }
    return methodList.toArray(new Method[methodList.size()]);
}
 
开发者ID:codelibs,项目名称:elasticsearch-auth,代码行数:20,代码来源:AuthService.java

示例3: testSetupRestHandlerContainsKnownBuiltin

import org.elasticsearch.rest.RestRequest.Method; //导入依赖的package包/类
public void testSetupRestHandlerContainsKnownBuiltin() {
    SettingsModule settings = new SettingsModule(Settings.EMPTY);
    ActionModule actionModule = new ActionModule(false, settings.getSettings(), new IndexNameExpressionResolver(Settings.EMPTY),
            settings.getIndexScopedSettings(), settings.getClusterSettings(), settings.getSettingsFilter(), null, emptyList(), null,
            null);
    actionModule.initRestHandlers(null);
    // At this point the easiest way to confirm that a handler is loaded is to try to register another one on top of it and to fail
    Exception e = expectThrows(IllegalArgumentException.class, () ->
        actionModule.getRestController().registerHandler(Method.GET, "/", null));
    assertThat(e.getMessage(), startsWith("Path [/] already has a value [" + RestMainAction.class.getName()));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:12,代码来源:ActionModuleTests.java

示例4: RocchioExpandRestAction

import org.elasticsearch.rest.RestRequest.Method; //导入依赖的package包/类
@Inject
public RocchioExpandRestAction(Settings settings, RestController controller) {
    super(settings);

    // Register your handlers here
    controller.registerHandler(Method.GET, "/{index}/{type}/_expand", this);
    controller.registerHandler(Method.GET, "/{index}/_expand", this);
}
 
开发者ID:biocaddie,项目名称:elasticsearch-queryexpansion-plugin,代码行数:9,代码来源:RocchioExpandRestAction.java

示例5: generateLocalSearchRequest

import org.elasticsearch.rest.RestRequest.Method; //导入依赖的package包/类
private static SearchRequest generateLocalSearchRequest(String source, String indexName, String type) {
    LocalRestRequest localRestRequest = new LocalRestRequest("/_search", Method.POST);
    localRestRequest.setContent(source, null);
    SearchRequest searchRequest = new SearchRequest();
    searchRequest.indices(Strings.splitStringByCommaToArray(indexName));
    // get the content, and put it in the body
    // add content/source as template if template flag is set
    searchRequest.source(localRestRequest.content());
    searchRequest.searchType(SearchType.QUERY_AND_FETCH);
    searchRequest.extraSource(RestSearchAction.parseSearchSource(localRestRequest));
    searchRequest.types(Strings.splitStringByCommaToArray(type));
    searchRequest.putHeader("search_source", "reindex");
    return searchRequest;
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:15,代码来源:IndexShard.java

示例6: RestConsoleAction

import org.elasticsearch.rest.RestRequest.Method; //导入依赖的package包/类
public RestConsoleAction(Settings settings, RestController controller, ClusterSettings clusterSettings, SettingsFilter settingsFilter) {
	super(settings);
	// TODO Auto-generated constructor stub
	controller.registerHandler(Method.GET, "/_console", this);
	controller.registerHandler(Method.GET, "/_console/{action}", this);

	String path = Common.getPathResources(settings);
	this.getPath = path;
	log(9, path);

}
 
开发者ID:psfu,项目名称:es-sp-console,代码行数:12,代码来源:RestConsoleAction.java

示例7: HelloWorldHandler

import org.elasticsearch.rest.RestRequest.Method; //导入依赖的package包/类
@Inject
public HelloWorldHandler(Settings settings, RestController controller, Client client) {
	super(settings, controller, client);
	//将该Handler绑定到某访问路径  
       controller.registerHandler(Method.GET, "/hello/", this);
       controller.registerHandler(Method.GET, "/hello/{name}", this);  
}
 
开发者ID:iminto,项目名称:elasticplugindemo,代码行数:8,代码来源:HelloWorldHandler.java

示例8: AuditRestAction

import org.elasticsearch.rest.RestRequest.Method; //导入依赖的package包/类
@Inject
public AuditRestAction(final Settings settings, final Client client, final RestController controller) {
    super(settings, controller, client);
    controller.registerHandler(Method.GET, "/_cluster/_auditflush", this);
    controller.registerHandler(Method.POST, "/_cluster/_auditflush", this);

}
 
开发者ID:salyh,项目名称:elasticsearch-sample-plugin-audit,代码行数:8,代码来源:AuditRestAction.java

示例9: isNtlmType1PostAuthorizationHeader

import org.elasticsearch.rest.RestRequest.Method; //导入依赖的package包/类
/**
 * When using NTLM authentication and the browser is making a POST request, it preemptively sends a Type 2
 * authentication message (without the POSTed data). The server responds with a 401, and the browser sends a Type 3
 * request with the POSTed data. This is to avoid the situation where user's credentials might be potentially
 * invalid, and all this data is being POSTed across the wire.
 * 
 * @return True if request is an NTLM POST or PUT with an Authorization header and no data.
 * @throws AuthException
 */
public boolean isNtlmType1PostAuthorizationHeader() throws AuthException {
    if (this.request.method() != Method.POST && this.request.method() != Method.PUT) {
        return false;
    }

    if (this.request.content() != null && this.request.content().length() > 0) {
        return false;
    }

    return isNtlmType1Message() || isSPNegoMessage();
}
 
开发者ID:petalmd,项目名称:armor,代码行数:21,代码来源:AuthorizationHeader.java

示例10: RestClearQRCacheAction

import org.elasticsearch.rest.RestRequest.Method; //导入依赖的package包/类
@Inject
public RestClearQRCacheAction(final Settings settings, final Client client,
        final RestController controller,
        final QueryResultCache queryResultCache) {
    super(settings, controller, client);
    this.queryResultCache = queryResultCache;
    this.logger = Loggers.getLogger(
            QueryResultCachePlugin.REST_LOGGER_NAME, settings);

    controller.registerHandler(Method.POST, "/_qrc/clear", this);
    controller.registerHandler(Method.POST, "/{index}/_qrc/clear", this);
}
 
开发者ID:codelibs,项目名称:elasticsearch-qrcache,代码行数:13,代码来源:RestClearQRCacheAction.java

示例11: RestStatsQRCacheAction

import org.elasticsearch.rest.RestRequest.Method; //导入依赖的package包/类
@Inject
public RestStatsQRCacheAction(final Settings settings, final Client client,
        final RestController controller,
        final QueryResultCache queryResultCache) {
    super(settings, controller, client);
    this.queryResultCache = queryResultCache;
    this.logger = Loggers.getLogger(
            QueryResultCachePlugin.REST_LOGGER_NAME, settings);

    controller.registerHandler(Method.GET, "/_qrc/stats", this);
}
 
开发者ID:codelibs,项目名称:elasticsearch-qrcache,代码行数:12,代码来源:RestStatsQRCacheAction.java

示例12: S3ManageAction

import org.elasticsearch.rest.RestRequest.Method; //导入依赖的package包/类
@Inject
public S3ManageAction(Settings settings, Client client, RestController controller){
   super(settings, controller, client);

   // Define S3 REST endpoints.
   controller.registerHandler(Method.GET, "/_s3/{rivername}/{command}", this);
}
 
开发者ID:lbroudoux,项目名称:es-amazon-s3-river,代码行数:8,代码来源:S3ManageAction.java

示例13: getRoles

import org.elasticsearch.rest.RestRequest.Method; //导入依赖的package包/类
public String[] getRoles(final Method method) {
    final Set<String> roleSet = methodMap.get(method);
    if (roleSet != null) {
        return roleSet.toArray(new String[roleSet.size()]);
    }
    return new String[0];
}
 
开发者ID:codelibs,项目名称:elasticsearch-auth,代码行数:8,代码来源:LoginConstraint.java

示例14: addRoles

import org.elasticsearch.rest.RestRequest.Method; //导入依赖的package包/类
private void addRoles(final Method method, final String[] roles) {
    synchronized (methodMap) {
        Set<String> roleSet = methodMap.get(method);
        if (roleSet == null) {
            roleSet = new HashSet<String>();
            methodMap.put(method, roleSet);
        }
        for (final String role : roles) {
            roleSet.add(role);
        }
    }
}
 
开发者ID:codelibs,项目名称:elasticsearch-auth,代码行数:13,代码来源:LoginConstraint.java

示例15: RestListAlgorithmsAction

import org.elasticsearch.rest.RestRequest.Method; //导入依赖的package包/类
public RestListAlgorithmsAction(
        Settings settings,
        RestController controller) {
    super(settings);

    controller.registerHandler(Method.POST, "/" + NAME, this);
    controller.registerHandler(Method.GET, "/" + NAME, this);
}
 
开发者ID:carrot2,项目名称:elasticsearch-carrot2,代码行数:9,代码来源:ListAlgorithmsAction.java


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