io.netty.handler.codec.TooLongFrameException.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(7.4k)|赞(0)|评价(0)|浏览(1363)

本文整理了Java中io.netty.handler.codec.TooLongFrameException.<init>()方法的一些代码示例,展示了TooLongFrameException.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TooLongFrameException.<init>()方法的具体详情如下:
包路径:io.netty.handler.codec.TooLongFrameException
类名称:TooLongFrameException
方法名:<init>

TooLongFrameException.<init>介绍

[英]Creates a new instance.
[中]创建一个新实例。

代码示例

代码示例来源:origin: netty/netty

private void fail(long frameLength) {
  if (frameLength > 0) {
    throw new TooLongFrameException(
            "frame length exceeds " + maxFrameLength +
            ": " + frameLength + " - discarded");
  } else {
    throw new TooLongFrameException(
            "frame length exceeds " + maxFrameLength +
            " - discarding");
  }
}

代码示例来源:origin: netty/netty

private void fail(long frameLength) {
    if (frameLength > 0) {
      throw new TooLongFrameException(
              "Adjusted frame length exceeds " + maxFrameLength +
              ": " + frameLength + " - discarded");
    } else {
      throw new TooLongFrameException(
              "Adjusted frame length exceeds " + maxFrameLength +
              " - discarding");
    }
  }
}

代码示例来源:origin: netty/netty

private void fail(long frameLength) {
  if (frameLength > 0) {
    throw new TooLongFrameException(
            "frame length exceeds " + maxFrameLength + ": " + frameLength + " - discarded");
  } else {
    throw new TooLongFrameException(
            "frame length exceeds " + maxFrameLength + " - discarding");
  }
}

代码示例来源:origin: redisson/redisson

private void fail(long frameLength) {
  if (frameLength > 0) {
    throw new TooLongFrameException(
            "frame length exceeds " + maxFrameLength +
            ": " + frameLength + " - discarded");
  } else {
    throw new TooLongFrameException(
            "frame length exceeds " + maxFrameLength +
            " - discarding");
  }
}

代码示例来源:origin: redisson/redisson

private void fail(long frameLength) {
    if (frameLength > 0) {
      throw new TooLongFrameException(
              "Adjusted frame length exceeds " + maxFrameLength +
              ": " + frameLength + " - discarded");
    } else {
      throw new TooLongFrameException(
              "Adjusted frame length exceeds " + maxFrameLength +
              " - discarding");
    }
  }
}

代码示例来源:origin: redisson/redisson

private void fail(long frameLength) {
  if (frameLength > 0) {
    throw new TooLongFrameException(
            "frame length exceeds " + maxFrameLength + ": " + frameLength + " - discarded");
  } else {
    throw new TooLongFrameException(
            "frame length exceeds " + maxFrameLength + " - discarding");
  }
}

代码示例来源:origin: Graylog2/graylog2-server

private void fail(long frameLength) {
  if (frameLength > 0) {
    throw new TooLongFrameException(
        "frame length exceeds " + maxFrameLength +
            ": " + frameLength + " - discarded");
  } else {
    throw new TooLongFrameException(
        "frame length exceeds " + maxFrameLength +
            " - discarding");
  }
}

代码示例来源:origin: wildfly/wildfly

private static int toFrameLength(long l) {
  if (l > Integer.MAX_VALUE) {
    throw new TooLongFrameException("Length:" + l);
  } else {
    return (int) l;
  }
}

代码示例来源:origin: wildfly/wildfly

private void fail(long frameLength) {
  if (frameLength > 0) {
    throw new TooLongFrameException(
            "frame length exceeds " + maxFrameLength + ": " + frameLength + " - discarded");
  } else {
    throw new TooLongFrameException(
            "frame length exceeds " + maxFrameLength + " - discarding");
  }
}

代码示例来源:origin: wildfly/wildfly

@Override
  protected TooLongFrameException newException(int maxLength) {
    return new TooLongFrameException("An HTTP line is larger than " + maxLength + " bytes.");
  }
}

代码示例来源:origin: wildfly/wildfly

private void fail(long frameLength) {
    if (frameLength > 0) {
      throw new TooLongFrameException(
              "Adjusted frame length exceeds " + maxFrameLength +
              ": " + frameLength + " - discarded");
    } else {
      throw new TooLongFrameException(
              "Adjusted frame length exceeds " + maxFrameLength +
              " - discarding");
    }
  }
}

代码示例来源:origin: wildfly/wildfly

private void fail(long frameLength) {
  if (frameLength > 0) {
    throw new TooLongFrameException(
            "frame length exceeds " + maxFrameLength +
            ": " + frameLength + " - discarded");
  } else {
    throw new TooLongFrameException(
            "frame length exceeds " + maxFrameLength +
            " - discarding");
  }
}

代码示例来源:origin: netty/netty

private void fail(final ChannelHandlerContext ctx, String length) {
  ctx.fireExceptionCaught(
      new TooLongFrameException(
          "frame length (" + length + ") exceeds the allowed maximum (" + maxLength + ')'));
}

代码示例来源:origin: redisson/redisson

private void fail(final ChannelHandlerContext ctx, String length) {
  ctx.fireExceptionCaught(
      new TooLongFrameException(
          "frame length (" + length + ") exceeds the allowed maximum (" + maxLength + ')'));
}

代码示例来源:origin: Graylog2/graylog2-server

private void fail(final ChannelHandlerContext ctx, String length) {
  ctx.fireExceptionCaught(
      new TooLongFrameException(
          "frame length (" + length + ") exceeds the allowed maximum (" + maxLength + ')'));
}

代码示例来源:origin: netty/netty

/**
 * Invoked when an incoming request exceeds the maximum content length.  The default behvaior is to trigger an
 * {@code exceptionCaught()} event with a {@link TooLongFrameException}.
 *
 * @param ctx the {@link ChannelHandlerContext}
 * @param oversized the accumulated message up to this point, whose type is {@code S} or {@code O}
 */
protected void handleOversizedMessage(ChannelHandlerContext ctx, S oversized) throws Exception {
  ctx.fireExceptionCaught(
      new TooLongFrameException("content length exceeded " + maxContentLength() + " bytes."));
}

代码示例来源:origin: mpusher/mpush

private Packet decodeFrame(ByteBuf in) {
  int readableBytes = in.readableBytes();
  int bodyLength = in.readInt();
  if (readableBytes < (bodyLength + Packet.HEADER_LEN)) {
    return null;
  }
  if (bodyLength > maxPacketSize) {
    throw new TooLongFrameException("packet body length over limit:" + bodyLength);
  }
  return decodePacket(new Packet(in.readByte()), in, bodyLength);
}

代码示例来源:origin: redisson/redisson

/**
 * Invoked when an incoming request exceeds the maximum content length.  The default behvaior is to trigger an
 * {@code exceptionCaught()} event with a {@link TooLongFrameException}.
 *
 * @param ctx the {@link ChannelHandlerContext}
 * @param oversized the accumulated message up to this point, whose type is {@code S} or {@code O}
 */
protected void handleOversizedMessage(ChannelHandlerContext ctx, S oversized) throws Exception {
  ctx.fireExceptionCaught(
      new TooLongFrameException("content length exceeded " + maxContentLength() + " bytes."));
}

代码示例来源:origin: wildfly/wildfly

/**
 * Invoked when an incoming request exceeds the maximum content length.  The default behvaior is to trigger an
 * {@code exceptionCaught()} event with a {@link TooLongFrameException}.
 *
 * @param ctx the {@link ChannelHandlerContext}
 * @param oversized the accumulated message up to this point, whose type is {@code S} or {@code O}
 */
protected void handleOversizedMessage(ChannelHandlerContext ctx, S oversized) throws Exception {
  ctx.fireExceptionCaught(
      new TooLongFrameException("content length exceeded " + maxContentLength() + " bytes."));
}

代码示例来源:origin: netty/netty

@Override
protected void decode(ChannelHandlerContext ctx, ByteBuf buffer, List<Object> out) throws Exception {
  if (discardingTooLongFrame) {
    buffer.skipBytes(actualReadableBytes());
    checkpoint();
    return;
  }
  Unmarshaller unmarshaller = provider.getUnmarshaller(ctx);
  ByteInput input = new ChannelBufferByteInput(buffer);
  if (maxObjectSize != Integer.MAX_VALUE) {
    input = new LimitingByteInput(input, maxObjectSize);
  }
  try {
    unmarshaller.start(input);
    Object obj = unmarshaller.readObject();
    unmarshaller.finish();
    out.add(obj);
  } catch (LimitingByteInput.TooBigObjectException ignored) {
    discardingTooLongFrame = true;
    throw new TooLongFrameException();
  } finally {
    // Call close in a finally block as the ReplayingDecoder will throw an Error if not enough bytes are
    // readable. This helps to be sure that we do not leak resource
    unmarshaller.close();
  }
}

相关文章

微信公众号

最新文章

更多

TooLongFrameException类方法