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


Java DefaultHttpDataFactory.MINSIZE属性代码示例

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


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

示例1: setHttpRequest

public void setHttpRequest(HttpRequest request) throws BadRequestException, IOException {
  if (request == null) {
    LOG.error("HttpRequest not initialized");
    throw new BadRequestException("HttpRequest not initialized");
  }
  if (!request.getMethod().equals(HttpMethod.POST)) {
    LOG.error("Got invalid HTTP method: expecting only POST");
    throw new BadRequestException("Incorrect method "
        + request.getMethod().toString() + ", expected POST");
  }
  HttpDataFactory factory = new DefaultHttpDataFactory(DefaultHttpDataFactory.MINSIZE);
  HttpPostRequestDecoder decoder = new HttpPostRequestDecoder(factory, request);
  InterfaceHttpData data = decoder.getBodyHttpData(HTTP_TEST_ATTRIBUTE);
  if (data == null) {
    LOG.error("HTTP Resolve request inccorect, {} attribute not found", HTTP_TEST_ATTRIBUTE);
    throw new BadRequestException("HTTP Resolve request inccorect, " +
        HTTP_TEST_ATTRIBUTE + " attribute not found");
  }
  Attribute attribute = (Attribute) data;
  requestData = attribute.get();
  LOG.trace("Name {}, type {} found, data size {}", data.getName(), data.getHttpDataType().name(), requestData.length);
}
 
开发者ID:kaaproject,项目名称:kaa,代码行数:22,代码来源:NettyHttpTestIT.java

示例2: parse

@Override
public void parse() throws Exception {
  LOG.trace("CommandName: " + COMMAND_NAME + ": Parse..");
  HttpDataFactory factory = new DefaultHttpDataFactory(DefaultHttpDataFactory.MINSIZE);
  HttpPostRequestDecoder decoder = new HttpPostRequestDecoder(factory, getRequest());
  if (decoder.isMultipart()) {
    LOG.trace("Chunked: " + HttpHeaders.isTransferEncodingChunked(getRequest()));
    LOG.trace(": Multipart..");
    List<InterfaceHttpData> datas = decoder.getBodyHttpDatas();
    if (!datas.isEmpty()) {
      for (InterfaceHttpData data : datas) {
        LOG.trace("Multipart1 name " + data.getName() + " type " + data.getHttpDataType().name());
        if (data.getHttpDataType() == HttpDataType.Attribute) {
          Attribute attribute = (Attribute) data;
          if (CommonEpConstans.REQUEST_SIGNATURE_ATTR_NAME.equals(data.getName())) {
            requestSignature = attribute.get();
            if (LOG.isTraceEnabled()) {
              LOG.trace("Multipart name " + data.getName() + " type "
                  + data.getHttpDataType().name() + " Signature set. size: "
                  + requestSignature.length);
              LOG.trace(MessageEncoderDecoder.bytesToHex(requestSignature));
            }

          } else if (CommonEpConstans.REQUEST_KEY_ATTR_NAME.equals(data.getName())) {
            requestKey = attribute.get();
            if (LOG.isTraceEnabled()) {
              LOG.trace("Multipart name " + data.getName() + " type "
                  + data.getHttpDataType().name() + " requestKey set. size: "
                  + requestKey.length);
              LOG.trace(MessageEncoderDecoder.bytesToHex(requestKey));
            }
          } else if (CommonEpConstans.REQUEST_DATA_ATTR_NAME.equals(data.getName())) {
            requestData = attribute.get();
            if (LOG.isTraceEnabled()) {
              LOG.trace("Multipart name " + data.getName() + " type "
                  + data.getHttpDataType().name() + " requestData set. size: "
                  + requestData.length);
              LOG.trace(MessageEncoderDecoder.bytesToHex(requestData));
            }
          } else if (CommonEpConstans.NEXT_PROTOCOL_ATTR_NAME.equals(data.getName())) {
            nextProtocol = ByteBuffer.wrap(attribute.get()).getInt();
            LOG.trace("[{}] next protocol is {}", getSessionUuid(), nextProtocol);
          }
        }
      }
    } else {
      LOG.error("Multipart.. size 0");
      throw new BadRequestException("HTTP Request inccorect, multiprat size is 0");
    }
  }
}
 
开发者ID:kaaproject,项目名称:kaa,代码行数:51,代码来源:AbstractHttpSyncCommand.java

示例3: MyHttpPostRequestEncoder

/**
 *
 * @param request
 *            the request to encode
 * @param multipart
 *            True if the FORM is a ENCTYPE="multipart/form-data"
 * @throws NullPointerException
 *             for request
 * @throws ErrorDataEncoderException
 *             if the request is not a POST
 */
public MyHttpPostRequestEncoder(HttpRequest request, boolean multipart) throws ErrorDataEncoderException {
    this(new DefaultHttpDataFactory(DefaultHttpDataFactory.MINSIZE), request, multipart,
            HttpConstants.DEFAULT_CHARSET, EncoderMode.RFC1738);
}
 
开发者ID:desperado1992,项目名称:distributeTemplate,代码行数:15,代码来源:MyHttpPostRequestEncoder.java


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