• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ChannelBufferBytesReference类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: NettyHttpRequest

import org.elasticsearch.common.bytes.ChannelBufferBytesReference; //导入依赖的package包/类
public NettyHttpRequest(org.jboss.netty.handler.codec.http.HttpRequest request, Channel channel) {
    this.request = request;
    this.channel = channel;
    this.params = new HashMap<>();
    if (request.getContent().readable()) {
        this.content = new ChannelBufferBytesReference(request.getContent());
    } else {
        this.content = BytesArray.EMPTY;
    }

    String uri = request.getUri();
    int pathEndPos = uri.indexOf('?');
    if (pathEndPos < 0) {
        this.rawPath = uri;
    } else {
        this.rawPath = uri.substring(0, pathEndPos);
        RestUtils.decodeQueryString(uri, pathEndPos + 1, params);
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:20,代码来源:NettyHttpRequest.java


示例2: createResponse

import org.elasticsearch.common.bytes.ChannelBufferBytesReference; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
protected SearchResponse createResponse(HttpContext<SearchRequest, SearchResponse> httpContext) throws IOException {
    if (httpContext == null) {
        throw new IllegalStateException("no http context");
    }
    HttpResponse httpResponse = httpContext.getHttpResponse();
    logger.info("{}", httpResponse.getContent().toString(CharsetUtil.UTF_8));
    BytesReference ref = new ChannelBufferBytesReference(httpResponse.getContent());
    Map<String, Object> map = JsonXContent.jsonXContent.createParser(ref).map();

    logger.info("{}", map);

    InternalSearchResponse internalSearchResponse = parseInternalSearchResponse(map);
    String scrollId = (String) map.get(SCROLL_ID);
    int totalShards = 0;
    int successfulShards = 0;
    if (map.containsKey(SHARDS)) {
        Map<String, ?> shards = (Map<String, ?>) map.get(SHARDS);
        totalShards = shards.containsKey(TOTAL) ? (Integer) shards.get(TOTAL) : -1;
        successfulShards = shards.containsKey(SUCCESSFUL) ? (Integer) shards.get(SUCCESSFUL) : -1;
    }
    int tookInMillis = map.containsKey(TOOK) ? (Integer) map.get(TOOK) : -1;
    ShardSearchFailure[] shardFailures = null;
    return new SearchResponse(internalSearchResponse, scrollId, totalShards, successfulShards, tookInMillis, shardFailures);
}
 
开发者ID:jprante,项目名称:elasticsearch-client-http,代码行数:27,代码来源:HttpSearchAction.java


示例3: parse

import org.elasticsearch.common.bytes.ChannelBufferBytesReference; //导入依赖的package包/类
private void parse(ChannelHandlerContext ctx, ChannelBuffer buffer, XContentBuilder builder) throws IOException {
    SocketAddress localAddress = ctx.getChannel().getLocalAddress();
    SocketAddress remoteAddress = ctx.getChannel().getRemoteAddress();
    ChannelBufferBytesReference ref = new ChannelBufferBytesReference(buffer);
    try {
        builder.startObject();
        builder.field("protocol", protocol);
        if (localAddress != null) {
            builder.field("local", localAddress.toString());
        }
        if (remoteAddress != null) {
            builder.field("remote", remoteAddress.toString());
        }
        messageParser.parseMessage(ref.toUtf8(), builder);
        builder.endObject();
    } catch (Exception e) {
        logger.error(e.getMessage(), e);
    }
}
 
开发者ID:jprante,项目名称:elasticsearch-syslog,代码行数:20,代码来源:SyslogService.java


示例4: createResponse

import org.elasticsearch.common.bytes.ChannelBufferBytesReference; //导入依赖的package包/类
@Override
protected RefreshResponse createResponse(HttpInvocationContext<RefreshRequest,RefreshResponse> httpInvocationContext) {
    if (httpInvocationContext == null) {
        throw new IllegalStateException("no http context");
    }
    HttpResponse httpResponse = httpInvocationContext.getHttpResponse();
    try {
        BytesReference ref = new ChannelBufferBytesReference(httpResponse.getContent());
        Map<String,Object> map = JsonXContent.jsonXContent.createParser(ref).map();
        logger.info("{}", map);
        //  RefreshResponse(int totalShards, int successfulShards, int failedShards, List<ShardOperationFailedException> shardFailures) {
        return new RefreshResponse();
    } catch (IOException e) {
        //
    }
    return null;
}
 
开发者ID:jprante,项目名称:elasticsearch-helper,代码行数:18,代码来源:HttpRefreshIndexAction.java


示例5: createResponse

import org.elasticsearch.common.bytes.ChannelBufferBytesReference; //导入依赖的package包/类
@Override
protected CreateIndexResponse createResponse(HttpInvocationContext<CreateIndexRequest,CreateIndexResponse> httpInvocationContext) {
    if (httpInvocationContext == null) {
        throw new IllegalStateException("no http context");
    }
    HttpResponse httpResponse = httpInvocationContext.getHttpResponse();
    try {
        BytesReference ref = new ChannelBufferBytesReference(httpResponse.getContent());
        Map<String,Object> map = JsonXContent.jsonXContent.createParser(ref).map();
        boolean acknowledged = map.containsKey("acknowledged") ? (Boolean)map.get("acknowledged") : false;
        return new CreateIndexResponse(acknowledged);
    } catch (IOException e) {
        //
    }
    return null;
}
 
开发者ID:jprante,项目名称:elasticsearch-helper,代码行数:17,代码来源:HttpCreateIndexAction.java


示例6: createResponse

import org.elasticsearch.common.bytes.ChannelBufferBytesReference; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
protected SearchResponse createResponse(HttpInvocationContext<SearchRequest,SearchResponse> httpInvocationContext) throws IOException {
    if (httpInvocationContext == null) {
        throw new IllegalStateException("no http context");
    }
    HttpResponse httpResponse = httpInvocationContext.getHttpResponse();
    logger.info("{}", httpResponse.getContent().toString(CharsetUtil.UTF_8));
    BytesReference ref = new ChannelBufferBytesReference(httpResponse.getContent());
    Map<String,Object> map = JsonXContent.jsonXContent.createParser(ref).map();

    logger.info("{}", map);

    InternalSearchResponse internalSearchResponse = parseInternalSearchResponse(map);
    String scrollId = (String)map.get(SCROLL_ID);
    int totalShards = 0;
    int successfulShards = 0;
    if (map.containsKey(SHARDS)) {
        Map<String,?> shards = (Map<String,?>)map.get(SHARDS);
        totalShards =  shards.containsKey(TOTAL) ? (Integer)shards.get(TOTAL) : -1;
        successfulShards =  shards.containsKey(SUCCESSFUL) ? (Integer)shards.get(SUCCESSFUL) : -1;
    }
    int tookInMillis = map.containsKey(TOOK) ? (Integer)map.get(TOOK) : -1;
    ShardSearchFailure[] shardFailures = parseShardFailures(map);
    return new SearchResponse(internalSearchResponse, scrollId, totalShards, successfulShards, tookInMillis, shardFailures);
}
 
开发者ID:jprante,项目名称:elasticsearch-helper,代码行数:27,代码来源:HttpSearchAction.java


示例7: createResponse

import org.elasticsearch.common.bytes.ChannelBufferBytesReference; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
protected BulkResponse createResponse(HttpInvocationContext<BulkRequest,BulkResponse> httpInvocationContext) {
    if (httpInvocationContext == null) {
        throw new IllegalStateException("no http context");
    }
    HttpResponse httpResponse = httpInvocationContext.getHttpResponse();
    try {
        BytesReference ref = new ChannelBufferBytesReference(httpResponse.getContent());
        Map<String,Object> map = JsonXContent.jsonXContent.createParser(ref).map();
        long tookInMillis = map.containsKey("took") ? (Integer)map.get("took") : -1L;
        BulkItemResponse[] responses = parseItems((List<Map<String,?>>)map.get("items"));
        return new BulkResponse(responses, tookInMillis);
    } catch (IOException e) {
        //
    }
    return null;
}
 
开发者ID:jprante,项目名称:elasticsearch-helper,代码行数:19,代码来源:HttpBulkAction.java


示例8: createResponse

import org.elasticsearch.common.bytes.ChannelBufferBytesReference; //导入依赖的package包/类
@Override
protected RefreshResponse createResponse(HttpContext<RefreshRequest, RefreshResponse> httpContext) throws IOException {
    if (httpContext == null) {
        throw new IllegalStateException("no http context");
    }
    HttpResponse httpResponse = httpContext.getHttpResponse();
    BytesReference ref = new ChannelBufferBytesReference(httpResponse.getContent());
    Map<String, Object> map = JsonXContent.jsonXContent.createParser(ref).map();
    logger.info("{}", map);
    //  RefreshResponse(int totalShards, int successfulShards, int failedShards,
    //     List<ShardOperationFailedException> shardFailures) {
    return new RefreshResponse();
}
 
开发者ID:jprante,项目名称:elasticsearch-client-http,代码行数:14,代码来源:HttpRefreshIndexAction.java


示例9: createResponse

import org.elasticsearch.common.bytes.ChannelBufferBytesReference; //导入依赖的package包/类
@Override
protected CreateIndexResponse createResponse(HttpContext<CreateIndexRequest, CreateIndexResponse> httpContext)
        throws IOException {
    if (httpContext == null) {
        throw new IllegalStateException("no http context");
    }
    HttpResponse httpResponse = httpContext.getHttpResponse();
    BytesReference ref = new ChannelBufferBytesReference(httpResponse.getContent());
    Map<String, Object> map = JsonXContent.jsonXContent.createParser(ref).map();
    boolean acknowledged = map.containsKey("acknowledged") && (Boolean) map.get("acknowledged");
    return new CreateIndexResponse(acknowledged);
}
 
开发者ID:jprante,项目名称:elasticsearch-client-http,代码行数:13,代码来源:HttpCreateIndexAction.java


示例10: createResponse

import org.elasticsearch.common.bytes.ChannelBufferBytesReference; //导入依赖的package包/类
@Override
protected IndexResponse createResponse(HttpContext<IndexRequest, IndexResponse> httpContext) throws IOException {
    HttpResponse httpResponse = httpContext.getHttpResponse();
    BytesReference ref = new ChannelBufferBytesReference(httpResponse.getContent());
    Map<String, Object> map = JsonXContent.jsonXContent.createParser(ref).map();
    logger.info("{}", map);
    return new IndexResponse();
}
 
开发者ID:jprante,项目名称:elasticsearch-client-http,代码行数:9,代码来源:HttpIndexAction.java


示例11: createResponse

import org.elasticsearch.common.bytes.ChannelBufferBytesReference; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
protected BulkResponse createResponse(HttpContext<BulkRequest, BulkResponse> httpContext) throws IOException {
    if (httpContext == null) {
        throw new IllegalStateException("no http context");
    }
    HttpResponse httpResponse = httpContext.getHttpResponse();
    BytesReference ref = new ChannelBufferBytesReference(httpResponse.getContent());
    Map<String, Object> map = JsonXContent.jsonXContent.createParser(ref).map();
    long tookInMillis = map.containsKey("took") ? (Integer) map.get("took") : -1L;
    BulkItemResponse[] responses = parseItems((List<Map<String, ?>>) map.get("items"));
    return new BulkResponse(responses, tookInMillis);
}
 
开发者ID:jprante,项目名称:elasticsearch-client-http,代码行数:14,代码来源:HttpBulkAction.java


示例12: createResponse

import org.elasticsearch.common.bytes.ChannelBufferBytesReference; //导入依赖的package包/类
@Override
protected UpdateSettingsResponse createResponse(HttpInvocationContext<UpdateSettingsRequest,UpdateSettingsResponse> httpInvocationContext) throws IOException {
    if (httpInvocationContext == null) {
        throw new IllegalStateException("no http context");
    }
    HttpResponse httpResponse = httpInvocationContext.getHttpResponse();
    BytesReference ref = new ChannelBufferBytesReference(httpResponse.getContent());
    Map<String,Object> map = JsonXContent.jsonXContent.createParser(ref).map();
    return new UpdateSettingsResponse();
}
 
开发者ID:jprante,项目名称:elasticsearch-helper,代码行数:11,代码来源:HttpUpdateSettingsAction.java


示例13: createResponse

import org.elasticsearch.common.bytes.ChannelBufferBytesReference; //导入依赖的package包/类
@Override
protected ClusterUpdateSettingsResponse createResponse(HttpInvocationContext<ClusterUpdateSettingsRequest,ClusterUpdateSettingsResponse> httpInvocationContext) throws IOException {
    if (httpInvocationContext == null) {
        throw new IllegalStateException("no http context");
    }
    HttpResponse httpResponse = httpInvocationContext.getHttpResponse();
    BytesReference ref = new ChannelBufferBytesReference(httpResponse.getContent());
    Map<String,Object> map = JsonXContent.jsonXContent.createParser(ref).map();
    return new ClusterUpdateSettingsResponse();
}
 
开发者ID:jprante,项目名称:elasticsearch-helper,代码行数:11,代码来源:HttpClusterUpdateSettingsAction.java


示例14: readBytesReference

import org.elasticsearch.common.bytes.ChannelBufferBytesReference; //导入依赖的package包/类
@Override
public BytesReference readBytesReference(int length) throws IOException {
    ChannelBufferBytesReference ref = new ChannelBufferBytesReference(buffer.slice(buffer.readerIndex(), length));
    buffer.skipBytes(length);
    return ref;
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:7,代码来源:ChannelBufferStreamInput.java


示例15: writeBytesReference_channelBuffer

import org.elasticsearch.common.bytes.ChannelBufferBytesReference; //导入依赖的package包/类
static int writeBytesReference_channelBuffer(ChannelBuffer spanBytes) throws IOException {
  BytesStreamOutput out = new BytesStreamOutput();
  out.writeBytesReference(new ChannelBufferBytesReference(spanBytes));
  return out.hashCode();
}
 
开发者ID:liaominghua,项目名称:zipkin,代码行数:6,代码来源:ElasticsearchBenchmarks.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java PlaneCollisionShape类代码示例发布时间:2022-05-23
下一篇:
Java RollingBatchRestartRs类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap