gpt4 book ai didi

com.netflix.zuul.netty.filter.ZuulEndPointRunner类的使用及代码示例

转载 作者:知者 更新时间:2024-03-18 20:29:31 27 4
gpt4 key购买 nike

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

ZuulEndPointRunner介绍

[英]This class is supposed to be thread safe and hence should not have any non final member variables Created by saroskar on 5/18/17.
[中]这个类应该是线程安全的,因此不应该有saroskar在2017年5月18日创建的任何非最终成员变量。

代码示例

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

protected ZuulEndPointRunner getEndpointRunner(ZuulFilterChainRunner<HttpResponseMessage> responseFilterChain,
                        FilterUsageNotifier filterUsageNotifier, FilterLoader filterLoader) {
  return new ZuulEndPointRunner(filterUsageNotifier, filterLoader, responseFilterChain);
}

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

@Override
public void filter(final HttpRequestMessage zuulReq) {
  if (zuulReq.getContext().isCancelled()) {
    zuulReq.disposeBufferedBody();
    logger.debug("Request was cancelled, UUID {}", zuulReq.getContext().getUUID());
    return;
  }
  final String endpointName = getEndPointName(zuulReq.getContext());
  try {
    Preconditions.checkNotNull(zuulReq, "input message");
    final ZuulFilter<HttpRequestMessage, HttpResponseMessage> endpoint = getEndpoint(endpointName, zuulReq);
    logger.debug("Got endpoint {}, UUID {}", endpoint.filterName(), zuulReq.getContext().getUUID());
    setEndpoint(zuulReq, endpoint);
    final HttpResponseMessage zuulResp = filter(endpoint, zuulReq);
    if ((zuulResp != null)&&(! (endpoint instanceof ProxyEndpoint))) {
      //EdgeProxyEndpoint calls invokeNextStage internally
      logger.debug("Endpoint calling invokeNextStage, UUID {}", zuulReq.getContext().getUUID());
      invokeNextStage(zuulResp);
    }
  }
  catch (Exception ex) {
    handleException(zuulReq, endpointName, ex);
  }
}

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

/**
 * Override to inject your own proxy endpoint implementation
 *
 * @param zuulRequest - the request message
 * @return the proxy endpoint
 */
protected ZuulFilter<HttpRequestMessage, HttpResponseMessage> newProxyEndpoint(HttpRequestMessage zuulRequest) {
  return new ProxyEndpoint(zuulRequest, getChannelHandlerContext(zuulRequest), getNextStage(), MethodBinding.NO_OP_BINDING);
}

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

protected ZuulFilter<HttpRequestMessage, HttpResponseMessage> getEndpoint(final String endpointName,
      final HttpRequestMessage zuulRequest) {
  final SessionContext zuulCtx = zuulRequest.getContext();
  if (zuulCtx.getStaticResponse() != null) {
    return STATIC_RESPONSE_ENDPOINT;
  }
  if (endpointName == null) {
    return new MissingEndpointHandlingFilter("NO_ENDPOINT_NAME");
  }
  if (PROXY_ENDPOINT_FILTER_NAME.equals(endpointName)) {
    return newProxyEndpoint(zuulRequest);
  }
  final Endpoint<HttpRequestMessage, HttpResponseMessage> filter = getEndpointFilter(endpointName);
  if (filter == null) {
    return new MissingEndpointHandlingFilter(endpointName);
  }
  return filter;
}

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

@Override
public void filter(final HttpRequestMessage zuulReq, final HttpContent chunk) {
  if (zuulReq.getContext().isCancelled()) {
    chunk.release();
    return;
  }
  String endpointName = "-";
  try {
    ZuulFilter<HttpRequestMessage, HttpResponseMessage> endpoint = Preconditions.checkNotNull(
        getEndpoint(zuulReq), "endpoint");
    endpointName = endpoint.filterName();
    final HttpContent newChunk = endpoint.processContentChunk(zuulReq, chunk);
    if (newChunk != null) {
      //Endpoints do not directly forward content chunks to next stage in the filter chain.
      zuulReq.bufferBodyContents(newChunk);
      //deallocate original chunk if necessary
      if (newChunk != chunk) {
        chunk.release();
      }
      if (isFilterAwaitingBody(zuulReq) && zuulReq.hasCompleteBody() && !(endpoint instanceof ProxyEndpoint)) {
        //whole body has arrived, resume filter chain
        invokeNextStage(filter(endpoint, zuulReq));
      }
    }
  }
  catch (Exception ex) {
    handleException(zuulReq, endpointName, ex);
  }
}

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

@Override
protected void resume(final HttpResponseMessage zuulMesg) {
  if (zuulMesg.getContext().isCancelled()) {
    return;
  }
  invokeNextStage(zuulMesg);
}

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

protected void fireEndpointFinish(final boolean error) {
  final ZuulFilter endpoint = ZuulEndPointRunner.getEndpoint(zuulRequest);
  if (endpoint instanceof ProxyEndpoint) {
    final ProxyEndpoint edgeProxyEndpoint = (ProxyEndpoint) endpoint;
    edgeProxyEndpoint.finish(error);
  }
  zuulRequest = null;
}

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

@Override
public void filter(final HttpRequestMessage zuulReq, final HttpContent chunk) {
  if (zuulReq.getContext().isCancelled()) {
    chunk.release();
    return;
  }
  String endpointName = "-";
  try {
    ZuulFilter<HttpRequestMessage, HttpResponseMessage> endpoint = Preconditions.checkNotNull(
        getEndpoint(zuulReq), "endpoint");
    endpointName = endpoint.filterName();
    final HttpContent newChunk = endpoint.processContentChunk(zuulReq, chunk);
    if (newChunk != null) {
      //Endpoints do not directly forward content chunks to next stage in the filter chain.
      zuulReq.bufferBodyContents(newChunk);
      //deallocate original chunk if necessary
      if (newChunk != chunk) {
        chunk.release();
      }
      if (isFilterAwaitingBody(zuulReq) && zuulReq.hasCompleteBody() && !(endpoint instanceof ProxyEndpoint)) {
        //whole body has arrived, resume filter chain
        invokeNextStage(filter(endpoint, zuulReq));
      }
    }
  }
  catch (Exception ex) {
    handleException(zuulReq, endpointName, ex);
  }
}

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

protected ZuulFilter<HttpRequestMessage, HttpResponseMessage> getEndpoint(final String endpointName,
      final HttpRequestMessage zuulRequest) {
  final SessionContext zuulCtx = zuulRequest.getContext();
  if (zuulCtx.getStaticResponse() != null) {
    return STATIC_RESPONSE_ENDPOINT;
  }
  if (endpointName == null) {
    return new MissingEndpointHandlingFilter("NO_ENDPOINT_NAME");
  }
  if (PROXY_ENDPOINT_FILTER_NAME.equals(endpointName)) {
    return newProxyEndpoint(zuulRequest);
  }
  final Endpoint<HttpRequestMessage, HttpResponseMessage> filter = getEndpointFilter(endpointName);
  if (filter == null) {
    return new MissingEndpointHandlingFilter(endpointName);
  }
  return filter;
}

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

@Override
protected void resume(final HttpResponseMessage zuulMesg) {
  if (zuulMesg.getContext().isCancelled()) {
    return;
  }
  invokeNextStage(zuulMesg);
}

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

protected void fireEndpointFinish(final boolean error) {
  final ZuulFilter endpoint = ZuulEndPointRunner.getEndpoint(zuulRequest);
  if (endpoint instanceof ProxyEndpoint) {
    final ProxyEndpoint edgeProxyEndpoint = (ProxyEndpoint) endpoint;
    edgeProxyEndpoint.finish(error);
  }
  zuulRequest = null;
}

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

@Override
public void filter(final HttpRequestMessage zuulReq) {
  if (zuulReq.getContext().isCancelled()) {
    zuulReq.disposeBufferedBody();
    logger.debug("Request was cancelled, UUID {}", zuulReq.getContext().getUUID());
    return;
  }
  final String endpointName = getEndPointName(zuulReq.getContext());
  try {
    Preconditions.checkNotNull(zuulReq, "input message");
    final ZuulFilter<HttpRequestMessage, HttpResponseMessage> endpoint = getEndpoint(endpointName, zuulReq);
    logger.debug("Got endpoint {}, UUID {}", endpoint.filterName(), zuulReq.getContext().getUUID());
    setEndpoint(zuulReq, endpoint);
    final HttpResponseMessage zuulResp = filter(endpoint, zuulReq);
    if ((zuulResp != null)&&(! (endpoint instanceof ProxyEndpoint))) {
      //EdgeProxyEndpoint calls invokeNextStage internally
      logger.debug("Endpoint calling invokeNextStage, UUID {}", zuulReq.getContext().getUUID());
      invokeNextStage(zuulResp);
    }
  }
  catch (Exception ex) {
    handleException(zuulReq, endpointName, ex);
  }
}

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

@Override
public void filter(final HttpRequestMessage zuulReq, final HttpContent chunk) {
  if (zuulReq.getContext().isCancelled()) {
    chunk.release();
    return;
  }
  String endpointName = "-";
  try {
    ZuulFilter<HttpRequestMessage, HttpResponseMessage> endpoint = Preconditions.checkNotNull(
        getEndpoint(zuulReq), "endpoint");
    endpointName = endpoint.filterName();
    final HttpContent newChunk = endpoint.processContentChunk(zuulReq, chunk);
    if (newChunk != null) {
      //Endpoints do not directly forward content chunks to next stage in the filter chain.
      zuulReq.bufferBodyContents(newChunk);
      //deallocate original chunk if necessary
      if (newChunk != chunk) {
        chunk.release();
      }
      if (isFilterAwaitingBody(zuulReq) && zuulReq.hasCompleteBody() && !(endpoint instanceof ProxyEndpoint)) {
        //whole body has arrived, resume filter chain
        invokeNextStage(filter(endpoint, zuulReq));
      }
    }
  }
  catch (Exception ex) {
    handleException(zuulReq, endpointName, ex);
  }
}

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

/**
 * Override to inject your own proxy endpoint implementation
 *
 * @param zuulRequest - the request message
 * @return the proxy endpoint
 */
protected ZuulFilter<HttpRequestMessage, HttpResponseMessage> newProxyEndpoint(HttpRequestMessage zuulRequest) {
  return new ProxyEndpoint(zuulRequest, getChannelHandlerContext(zuulRequest), getNextStage(), MethodBinding.NO_OP_BINDING);
}

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

protected ZuulFilter<HttpRequestMessage, HttpResponseMessage> getEndpoint(final String endpointName,
      final HttpRequestMessage zuulRequest) {
  final SessionContext zuulCtx = zuulRequest.getContext();
  if (zuulCtx.getStaticResponse() != null) {
    return STATIC_RESPONSE_ENDPOINT;
  }
  if (endpointName == null) {
    return new MissingEndpointHandlingFilter("NO_ENDPOINT_NAME");
  }
  if (PROXY_ENDPOINT_FILTER_NAME.equals(endpointName)) {
    return newProxyEndpoint(zuulRequest);
  }
  final Endpoint<HttpRequestMessage, HttpResponseMessage> filter = getEndpointFilter(endpointName);
  if (filter == null) {
    return new MissingEndpointHandlingFilter(endpointName);
  }
  return filter;
}

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

@Override
protected void resume(final HttpResponseMessage zuulMesg) {
  if (zuulMesg.getContext().isCancelled()) {
    return;
  }
  invokeNextStage(zuulMesg);
}

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

protected void fireEndpointFinish(final boolean error) {
  final ZuulFilter endpoint = ZuulEndPointRunner.getEndpoint(zuulRequest);
  if (endpoint instanceof ProxyEndpoint) {
    final ProxyEndpoint edgeProxyEndpoint = (ProxyEndpoint) endpoint;
    edgeProxyEndpoint.finish(error);
  }
  zuulRequest = null;
}

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

protected ZuulEndPointRunner getEndpointRunner(ZuulFilterChainRunner<HttpResponseMessage> responseFilterChain,
                        FilterUsageNotifier filterUsageNotifier, FilterLoader filterLoader) {
  return new ZuulEndPointRunner(filterUsageNotifier, filterLoader, responseFilterChain);
}

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

@Override
public void filter(final HttpRequestMessage zuulReq) {
  if (zuulReq.getContext().isCancelled()) {
    zuulReq.disposeBufferedBody();
    logger.debug("Request was cancelled, UUID {}", zuulReq.getContext().getUUID());
    return;
  }
  final String endpointName = getEndPointName(zuulReq.getContext());
  try {
    Preconditions.checkNotNull(zuulReq, "input message");
    final ZuulFilter<HttpRequestMessage, HttpResponseMessage> endpoint = getEndpoint(endpointName, zuulReq);
    logger.debug("Got endpoint {}, UUID {}", endpoint.filterName(), zuulReq.getContext().getUUID());
    setEndpoint(zuulReq, endpoint);
    final HttpResponseMessage zuulResp = filter(endpoint, zuulReq);
    if ((zuulResp != null)&&(! (endpoint instanceof ProxyEndpoint))) {
      //EdgeProxyEndpoint calls invokeNextStage internally
      logger.debug("Endpoint calling invokeNextStage, UUID {}", zuulReq.getContext().getUUID());
      invokeNextStage(zuulResp);
    }
  }
  catch (Exception ex) {
    handleException(zuulReq, endpointName, ex);
  }
}

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

/**
 * Override to inject your own proxy endpoint implementation
 *
 * @param zuulRequest - the request message
 * @return the proxy endpoint
 */
protected ZuulFilter<HttpRequestMessage, HttpResponseMessage> newProxyEndpoint(HttpRequestMessage zuulRequest) {
  return new ProxyEndpoint(zuulRequest, getChannelHandlerContext(zuulRequest), getNextStage(), MethodBinding.NO_OP_BINDING);
}

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