gpt4 book ai didi

com.netflix.zuul.netty.filter.ZuulFilterChainRunner.filter()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-18 21:41:31 25 4
gpt4 key购买 nike

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

ZuulFilterChainRunner.filter介绍

暂无

代码示例

代码示例来源:origin: Netflix/zuul

@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
  if (msg instanceof HttpRequestMessage) {
    zuulRequest = (HttpRequestMessage)msg;
    //Replace NETTY_SERVER_CHANNEL_HANDLER_CONTEXT in SessionContext
    final SessionContext zuulCtx = zuulRequest.getContext();
    zuulCtx.put(NETTY_SERVER_CHANNEL_HANDLER_CONTEXT, ctx);
    zuulCtx.put(ZUUL_FILTER_CHAIN, requestFilterChain);
    requestFilterChain.filter(zuulRequest);
  }
  else if ((msg instanceof HttpContent)&&(zuulRequest != null)) {
    requestFilterChain.filter(zuulRequest, (HttpContent) msg);
  }
  else {
    LOG.debug("Received unrecognized message type. " + msg.getClass().getName());
    ReferenceCountUtil.release(msg);
  }
}

代码示例来源:origin: Netflix/zuul

private final void runFilters(final T mesg, final AtomicInteger runningFilterIdx) {
  T inMesg = mesg;
  String filterName = "-";
  try {
    Preconditions.checkNotNull(mesg, "Input message");
    int i = runningFilterIdx.get();
    while (i < filters.length) {
      final ZuulFilter<T, T> filter = filters[i];
      filterName = filter.filterName();
      final T outMesg = filter(filter, inMesg);
      if (outMesg == null) {
        return; //either async filter or waiting for the message body to be buffered
      }
      inMesg = outMesg;
      i = runningFilterIdx.incrementAndGet();
    }
    //Filter chain has reached its end, pass result to the next stage
    invokeNextStage(inMesg);
  }
  catch (Exception ex) {
    handleException(inMesg, filterName, ex);
  }
}

代码示例来源:origin: Netflix/zuul

@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
  if (msg instanceof HttpRequestMessage) {
    zuulRequest = (HttpRequestMessage)msg;
    //Replace NETTY_SERVER_CHANNEL_HANDLER_CONTEXT in SessionContext
    final SessionContext zuulCtx = zuulRequest.getContext();
    zuulCtx.put(NETTY_SERVER_CHANNEL_HANDLER_CONTEXT, ctx);
    zuulCtx.put(ZUUL_FILTER_CHAIN, requestFilterChain);
    requestFilterChain.filter(zuulRequest);
  }
  else if ((msg instanceof HttpContent)&&(zuulRequest != null)) {
    requestFilterChain.filter(zuulRequest, (HttpContent) msg);
  }
  else {
    LOG.debug("Received unrecognized message type. " + msg.getClass().getName());
    ReferenceCountUtil.release(msg);
  }
}

代码示例来源:origin: Netflix/zuul

private void sendResponse(final StatusCategory statusCategory, final int status, ChannelHandlerContext ctx) {
  if (zuulRequest == null) {
    ctx.close();
  }
  else {
    final SessionContext zuulCtx = zuulRequest.getContext();
    StatusCategoryUtils.storeStatusCategoryIfNotAlreadyFailure(zuulCtx, statusCategory);
    final HttpResponseMessage zuulResponse = new HttpResponseMessageImpl(zuulCtx, zuulRequest, status);
    final Headers headers = zuulResponse.getHeaders();
    headers.add("Connection", "close");
    headers.add("Content-Length", "0");
    zuulResponse.finishBufferedBodyIfIncomplete();
    responseFilterChain.filter(zuulResponse);
    fireEndpointFinish(true);
  }
}

代码示例来源:origin: Netflix/zuul

private final void runFilters(final T mesg, final AtomicInteger runningFilterIdx) {
  T inMesg = mesg;
  String filterName = "-";
  try {
    Preconditions.checkNotNull(mesg, "Input message");
    int i = runningFilterIdx.get();
    while (i < filters.length) {
      final ZuulFilter<T, T> filter = filters[i];
      filterName = filter.filterName();
      final T outMesg = filter(filter, inMesg);
      if (outMesg == null) {
        return; //either async filter or waiting for the message body to be buffered
      }
      inMesg = outMesg;
      i = runningFilterIdx.incrementAndGet();
    }
    //Filter chain has reached its end, pass result to the next stage
    invokeNextStage(inMesg);
  }
  catch (Exception ex) {
    handleException(inMesg, filterName, ex);
  }
}

代码示例来源:origin: Netflix/zuul

private void sendResponse(final StatusCategory statusCategory, final int status, ChannelHandlerContext ctx) {
  if (zuulRequest == null) {
    ctx.close();
  }
  else {
    final SessionContext zuulCtx = zuulRequest.getContext();
    StatusCategoryUtils.storeStatusCategoryIfNotAlreadyFailure(zuulCtx, statusCategory);
    final HttpResponseMessage zuulResponse = new HttpResponseMessageImpl(zuulCtx, zuulRequest, status);
    final Headers headers = zuulResponse.getHeaders();
    headers.add("Connection", "close");
    headers.add("Content-Length", "0");
    zuulResponse.finishBufferedBodyIfIncomplete();
    responseFilterChain.filter(zuulResponse);
    fireEndpointFinish(true);
  }
}

代码示例来源:origin: com.netflix.zuul/zuul-core

@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
  if (msg instanceof HttpRequestMessage) {
    zuulRequest = (HttpRequestMessage)msg;
    //Replace NETTY_SERVER_CHANNEL_HANDLER_CONTEXT in SessionContext
    final SessionContext zuulCtx = zuulRequest.getContext();
    zuulCtx.put(NETTY_SERVER_CHANNEL_HANDLER_CONTEXT, ctx);
    zuulCtx.put(ZUUL_FILTER_CHAIN, requestFilterChain);
    requestFilterChain.filter(zuulRequest);
  }
  else if ((msg instanceof HttpContent)&&(zuulRequest != null)) {
    requestFilterChain.filter(zuulRequest, (HttpContent) msg);
  }
  else {
    LOG.debug("Received unrecognized message type. " + msg.getClass().getName());
    ReferenceCountUtil.release(msg);
  }
}

代码示例来源:origin: com.netflix.zuul/zuul-core

private final void runFilters(final T mesg, final AtomicInteger runningFilterIdx) {
  T inMesg = mesg;
  String filterName = "-";
  try {
    Preconditions.checkNotNull(mesg, "Input message");
    int i = runningFilterIdx.get();
    while (i < filters.length) {
      final ZuulFilter<T, T> filter = filters[i];
      filterName = filter.filterName();
      final T outMesg = filter(filter, inMesg);
      if (outMesg == null) {
        return; //either async filter or waiting for the message body to be buffered
      }
      inMesg = outMesg;
      i = runningFilterIdx.incrementAndGet();
    }
    //Filter chain has reached its end, pass result to the next stage
    invokeNextStage(inMesg);
  }
  catch (Exception ex) {
    handleException(inMesg, filterName, ex);
  }
}

代码示例来源:origin: com.netflix.zuul/zuul-core

private void sendResponse(final StatusCategory statusCategory, final int status, ChannelHandlerContext ctx) {
  if (zuulRequest == null) {
    ctx.close();
  }
  else {
    final SessionContext zuulCtx = zuulRequest.getContext();
    StatusCategoryUtils.storeStatusCategoryIfNotAlreadyFailure(zuulCtx, statusCategory);
    final HttpResponseMessage zuulResponse = new HttpResponseMessageImpl(zuulCtx, zuulRequest, status);
    final Headers headers = zuulResponse.getHeaders();
    headers.add("Connection", "close");
    headers.add("Content-Length", "0");
    zuulResponse.finishBufferedBodyIfIncomplete();
    responseFilterChain.filter(zuulResponse);
    fireEndpointFinish(true);
  }
}

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com