本文整理汇总了Java中org.elasticsearch.rest.RestRequest.Method类的典型用法代码示例。如果您正苦于以下问题:Java Method类的具体用法?Java Method怎么用?Java Method使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Method类属于org.elasticsearch.rest.RestRequest包,在下文中一共展示了Method类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: DriveOAuthAction
import org.elasticsearch.rest.RestRequest.Method; //导入依赖的package包/类
@Inject
public DriveOAuthAction(Settings settings, Client client, RestController controller) {
super(settings, client);
// Define Drive REST endpoints.
controller.registerHandler(Method.GET, "/_drive/oauth/{client_id}/{client_secret}", this);
controller.registerHandler(Method.GET, "/_drive/oauth/{client_id}/{client_secret}/{auth_code}/{auth_code_1}", this);
}
开发者ID:lbroudoux,项目名称:es-google-drive-river,代码行数:9,代码来源:DriveOAuthAction.java
示例17: DriveManageAction
import org.elasticsearch.rest.RestRequest.Method; //导入依赖的package包/类
@Inject
public DriveManageAction(Settings settings, Client client, RestController controller){
super(settings, client);
// Define S3 REST endpoints.
controller.registerHandler(Method.GET, "/_drive/{rivername}/{command}", this);
}
开发者ID:lbroudoux,项目名称:es-google-drive-river,代码行数:8,代码来源:DriveManageAction.java
示例18: RestAddNodesAction
import org.elasticsearch.rest.RestRequest.Method; //导入依赖的package包/类
@Inject
public RestAddNodesAction(Settings settings, RestController controller, Client client) {
super(settings, controller, client);
controller.registerHandler(Method.PUT, "/_nodes/{nodeIpPort}", this);
controller.registerHandler(Method.POST, "/_nodes/{nodeIpPort}", this);
}
开发者ID:baidu,项目名称:Elasticsearch,代码行数:7,代码来源:RestAddNodesAction.java
示例19: RestSpToolsAction
import org.elasticsearch.rest.RestRequest.Method; //导入依赖的package包/类
public RestSpToolsAction(Settings settings, RestController controller) {
super(settings);
log(1, "--->@Inject RestSpToolsAction");
Functions fc = Functions.getFunctions(settings);
auther = fc.getAuther();
actionLogger = fc.getActionLogger();
controller.registerHandler(Method.GET, "/_sp", this);
controller.registerHandler(Method.GET, "/_sp/{func}", this);
controller.registerHandler(Method.GET, "/_sp/{func}/{action}", this);
loadConfig(settings);
}
开发者ID:psfu,项目名称:es-sp-tools,代码行数:17,代码来源:RestSpToolsAction.java
示例20: checkAndAuthenticateRequest
import org.elasticsearch.rest.RestRequest.Method; //导入依赖的package包/类
private boolean checkAndAuthenticateRequest(RestRequest request, RestChannel channel, NodeClient client) throws Exception {
threadContext.putTransient(ConfigConstants.SG_ORIGIN, Origin.REST.toString());
if(HTTPHelper.containsBadHeader(request)) {
log.error("bad http header found");
auditLog.logBadHeaders(request);
channel.sendResponse(new BytesRestResponse(channel, RestStatus.FORBIDDEN, ExceptionUtils.createBadHeaderException()));
return true;
}
if(SSLRequestHelper.containsBadHeader(threadContext, ConfigConstants.SG_CONFIG_PREFIX)) {
log.error("bad http header found");
auditLog.logBadHeaders(request);
channel.sendResponse(new BytesRestResponse(channel, RestStatus.FORBIDDEN, ExceptionUtils.createBadHeaderException()));
return true;
}
final SSLInfo sslInfo;
try {
if((sslInfo = SSLRequestHelper.getSSLInfo(settings, configPath, request, principalExtractor)) != null) {
if(sslInfo.getPrincipal() != null) {
threadContext.putTransient("_sg_ssl_principal", sslInfo.getPrincipal());
}
if(sslInfo.getX509Certs() != null) {
threadContext.putTransient("_sg_ssl_peer_certificates", sslInfo.getX509Certs());
}
threadContext.putTransient("_sg_ssl_protocol", sslInfo.getProtocol());
threadContext.putTransient("_sg_ssl_cipher", sslInfo.getCipher());
}
} catch (SSLPeerUnverifiedException e) {
log.error("No ssl info", e);
auditLog.logSSLException(request, e);
channel.sendResponse(new BytesRestResponse(channel, RestStatus.FORBIDDEN, e));
return true;
}
if(request.method() != Method.OPTIONS
&& !"/_searchguard/license".equals(request.path())
&& !"/_searchguard/health".equals(request.path())) {
if (!registry.authenticate(request, channel, threadContext)) {
// another roundtrip
return true;
}
}
return false;
}
开发者ID:floragunncom,项目名称:search-guard,代码行数:50,代码来源:SearchGuardRestFilter.java
注:本文中的org.elasticsearch.rest.RestRequest.Method类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论