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


Java DecoderResult.isSuccess方法代码示例

本文整理汇总了Java中io.netty.handler.codec.DecoderResult.isSuccess方法的典型用法代码示例。如果您正苦于以下问题:Java DecoderResult.isSuccess方法的具体用法?Java DecoderResult.isSuccess怎么用?Java DecoderResult.isSuccess使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在io.netty.handler.codec.DecoderResult的用法示例。


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

示例1: appendDecoderResult

import io.netty.handler.codec.DecoderResult; //导入方法依赖的package包/类
private static void appendDecoderResult(StringBuilder buf, HttpObject o) {
    DecoderResult result = o.getDecoderResult();
    if (result.isSuccess()) {
        return;
    }

    buf.append(".. WITH DECODER FAILURE: ");
    buf.append(result.cause());
    buf.append("\r\n");
}
 
开发者ID:eBay,项目名称:ServiceCOLDCache,代码行数:11,代码来源:HttpSnoopServerHandler.java

示例2: channelRead0

import io.netty.handler.codec.DecoderResult; //导入方法依赖的package包/类
@Override
protected void channelRead0(ChannelHandlerContext ctx, FullHttpRequest httpRequest) throws Exception {
    DecoderResult result = httpRequest.decoderResult();
    if (!result.isSuccess()) {
        throw new BadRequestException(result.cause());
    }
    logger.info("Get search request: " + httpRequest.uri());

    // only decode get path is enough
    Map<String, List<String>> requestParameters;
    QueryStringDecoder stringDecoder = new QueryStringDecoder(httpRequest.uri());
    requestParameters = stringDecoder.parameters();

    QueryMeta meta = new QueryMeta();

    for(Map.Entry<String, List<String>> entry : requestParameters.entrySet()) {
        if (entry.getKey().equals("options[]")) {
            // add filters
            List<String> filters = entry.getValue();
            filters.forEach(filter -> {
                String[] typeVal = filter.split(":");
                meta.addMeta(typeVal[0], typeVal[1]);
            });
        } else if (entry.getKey().equals("orderby")) {
            meta.setOrderBy(entry.getValue().get(0));
        } else {
            logger.warn("Unknown query parameter, ignore it:" + entry.toString());
        }
    }

    DecodedSearchRequest searchRequest = new DecodedSearchRequest(httpRequest, meta, orderNumber++);
    ctx.fireChannelRead(searchRequest);
}
 
开发者ID:compasses,项目名称:elastic-rabbitmq,代码行数:34,代码来源:SearchQueryDecoder.java

示例3: appendDecoderResult

import io.netty.handler.codec.DecoderResult; //导入方法依赖的package包/类
private static void appendDecoderResult(StringBuilder buf, HttpObject o) {
    DecoderResult result = o.decoderResult();
    if (result.isSuccess()) {
        return;
    }

    buf.append(".. WITH DECODER FAILURE: ");
    buf.append(result.cause());
    buf.append("\r\n");
}
 
开发者ID:cowthan,项目名称:JavaAyo,代码行数:11,代码来源:HttpSnoopServerHandler.java

示例4: appendDecoderResult

import io.netty.handler.codec.DecoderResult; //导入方法依赖的package包/类
private static void appendDecoderResult(StringBuilder buf, HttpObject o) {
  DecoderResult result = o.getDecoderResult();
  if (result.isSuccess()) {
    return;
  }

  buf.append(".. WITH DECODER FAILURE: ");
  buf.append(result.cause());
  buf.append("\r\n");
}
 
开发者ID:detectiveframework,项目名称:detective,代码行数:11,代码来源:HttpServerTask.java

示例5: channelRead0

import io.netty.handler.codec.DecoderResult; //导入方法依赖的package包/类
@Override
protected void channelRead0(ChannelHandlerContext ctx, HttpObject httpObject) throws Exception {

  DecoderResult result = httpObject.getDecoderResult();
  if (!result.isSuccess()) {
    throw new BadRequestException(result.cause());
  }

  Attribute<UUID> sessionUuidAttr = ctx.channel().attr(AbstractNettyServer.UUID_KEY);

  if (httpObject instanceof HttpRequest) {
    HttpRequest httpRequest = (HttpRequest) httpObject;
    LOG.trace("Session: {} got valid HTTP request:\n{}",
            sessionUuidAttr.get().toString(), httpRequest.headers().toString());
    if (httpRequest.getMethod().equals(HttpMethod.POST)) {
      String uri = httpRequest.getUri();
      AbstractCommand cp = (AbstractCommand) commandFactory.getCommandProcessor(uri);
      cp.setSessionUuid(sessionUuidAttr.get());
      cp.setRequest(httpRequest);
      cp.parse();
      ctx.fireChannelRead(cp);
    } else {
      LOG.error("Got invalid HTTP method: expecting only POST");
      throw new BadRequestException(
              "Incorrect method " + httpRequest.getMethod().toString() + ", expected POST"
      );
    }
  } else {
    LOG.warn("Session: {} got invalid HTTP object:\n{}",
            sessionUuidAttr.get().toString(), httpObject);
  }
}
 
开发者ID:kaaproject,项目名称:kaa,代码行数:33,代码来源:RequestDecoder.java


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