org.apache.catalina.Pipeline类的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(10.7k)|赞(0)|评价(0)|浏览(114)

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

Pipeline介绍

[英]Interface describing a collection of Valves that should be executed in sequence when the invoke() method is invoked. It is required that a Valve somewhere in the pipeline (usually the last one) must process the request and create the corresponding response, rather than trying to pass the request on.

There is generally a single Pipeline instance associated with each Container. The container's normal request processing functionality is generally encapsulated in a container-specific Valve, which should always be executed at the end of a pipeline. To facilitate this, the setBasic() method is provided to set the Valve instance that will always be executed last. Other Valves will be executed in the order that they were added, before the basic Valve is executed.
[中]接口,描述调用invoke()方法时应按顺序执行的阀集合。要求管道中的某个阀门(通常是最后一个)必须处理请求并创建相应的响应,而不是试图传递请求。
通常每个容器都有一个单独的管道实例。容器的正常请求处理功能通常封装在特定于容器的阀门中,该阀门应始终在管道末端执行。为了便于实现这一点,提供了setBasic()方法来设置将始终最后执行的阀实例。在执行基本阀门之前,其他阀门将按照添加顺序执行。

代码示例

代码示例来源:origin: apache/geode

protected void registerCommitSessionValve() {
 if (getLogger().isDebugEnabled()) {
  getLogger().debug(this + ": Registering CommitSessionValve");
 }
 commitSessionValve = new CommitSessionValve();
 getPipeline().addValve(commitSessionValve);
}

代码示例来源:origin: apache/geode

protected void unregisterJvmRouteBinderValve() {
 if (getLogger().isDebugEnabled()) {
  getLogger().debug(this + ": Unregistering JVM route binder valve");
 }
 if (jvmRouteBinderValve != null) {
  getPipeline().removeValve(jvmRouteBinderValve);
 }
}

代码示例来源:origin: codefollower/Tomcat-Research

Context context = request.getContext();
if( context.getLoader() != null ) {
      (context.getLoader().getClassLoader());
context.getPipeline().getFirst().event(request, response, event);
response.setSuspended(false);
Throwable t = (Throwable) request.getAttribute(
    RequestDispatcher.ERROR_EXCEPTION);
  request.getSession(false);

代码示例来源:origin: org.apache.catalina/com.springsource.org.apache.catalina

/**
 * Select the appropriate child Host to process this request,
 * based on the requested server name.  If no matching Host can
 * be found, return an appropriate HTTP error.
 *
 * @param request Request to be processed
 * @param response Response to be produced
 *
 * @exception IOException if an input/output error occurred
 * @exception ServletException if a servlet error occurred
 */
@Override
public final void invoke(Request request, Response response)
  throws IOException, ServletException {
  // Select the Host to be used for this Request
  Host host = request.getHost();
  if (host == null) {
    response.sendError
      (HttpServletResponse.SC_BAD_REQUEST,
       sm.getString("standardEngine.noHost", 
             request.getServerName()));
    return;
  }
  if (request.isAsyncSupported()) {
    request.setAsyncSupported(host.getPipeline().isAsyncSupported());
  }
  // Ask this Host to process this request
  host.getPipeline().getFirst().invoke(request, response);
}

代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9

Container parent = context.getParent();
while ((sso == null) && (parent != null)) {
  Valve valves[] = parent.getPipeline().getValves();
  for (int i = 0; i < valves.length; i++) {
    if (valves[i] instanceof SingleSignOn) {
    parent = parent.getParent();
if (log.isDebugEnabled()) {
  if (sso != null)
    log.debug("Found SingleSignOn Valve at " + sso);
  else
    log.debug("No SingleSignOn Valve is present");

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

MessageBytes requestPathMB = request.getRequestPathMB();
if ((requestPathMB.startsWithIgnoreCase("/META-INF/", 0))
    || (requestPathMB.equalsIgnoreCase("/META-INF"))
    || (requestPathMB.startsWithIgnoreCase("/WEB-INF/", 0))
    || (requestPathMB.equalsIgnoreCase("/WEB-INF"))) {
  response.sendError(HttpServletResponse.SC_NOT_FOUND);
  return;
Wrapper wrapper = request.getWrapper();
if (wrapper == null || wrapper.isUnavailable()) {
  response.sendError(HttpServletResponse.SC_NOT_FOUND);
  return;
  response.sendAcknowledgement();
} catch (IOException ioe) {
  container.getLogger().error(sm.getString(
      "standardContextValve.acknowledgeException"), ioe);
  request.setAttribute(RequestDispatcher.ERROR_EXCEPTION, ioe);
  response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
  return;
if (request.isAsyncSupported()) {
  request.setAsyncSupported(wrapper.getPipeline().isAsyncSupported());
wrapper.getPipeline().getFirst().invoke(request, response);

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

/**
 * Create a new StandardEngine component with the default basic Valve.
 */
public StandardEngine() {
  super();
  pipeline.setBasic(new StandardEngineValve());
  /* Set the jmvRoute using the system property jvmRoute */
  try {
    setJvmRoute(System.getProperty("jvmRoute"));
  } catch(Exception ex) {
    log.warn(sm.getString("standardEngine.jvmRouteFail"));
  }
  // By default, the engine will hold the reloading thread
  backgroundProcessorDelay = 10;
}

代码示例来源:origin: OryxProject/oryx

context.setWebappVersion("3.1");
context.setName("Oryx");
context.addWelcomeFile("index.html");
addErrorPages(context);
  authenticator.setNonceValidity(10 * 1000L); // Shorten from 5 minutes to 10 seconds
  authenticator.setNonceCacheSize(20000); // Increase from 1000 to 20000
  context.getPipeline().addValve(authenticator);

代码示例来源:origin: magro/memcached-session-manager

public void shutdown() {
  _log.info( "Stopping services." );
  _manager.getContext().getParent().getPipeline().removeValve(_trackingHostValve);
  _manager.getContext().getPipeline().removeValve(_trackingContextValve);
  _backupSessionService.shutdown();
  if ( _lockingStrategy != null ) {
    _lockingStrategy.shutdown();
  }
  if ( _storage != null ) {
    _storage.shutdown();
    _storage = null;
  }
  _transcoderFactory = null;
  _invalidSessionsCache.clear();
}

代码示例来源:origin: tomcat/catalina

Context context = request.getContext();
if (context == null) {
  response.sendError
    (HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
     sm.getString("standardHost.noContext"));
if( context.getLoader() != null ) {
      (context.getLoader().getClassLoader());
context.getPipeline().getFirst().invoke(request, response);
response.setSuspended(false);
Throwable t = (Throwable) request.getAttribute(Globals.EXCEPTION_ATTR);

代码示例来源:origin: chexagon/redis-session-manager

@Override
protected synchronized void startInternal() throws LifecycleException {
  super.startInternal();
  try {
    this._client = buildClient();
  } catch (Throwable t) {
    log.fatal("Unable to load serializer", t);
    throw new LifecycleException(t);
  }
  this.requestValve = new RedisSessionRequestValve(this, ignorePattern);
  getContext().getParent().getPipeline().addValve(requestValve);
  this.sessionExpirationTime = getContext().getSessionTimeout();
  if (this.sessionExpirationTime < 0) {
    log.warn("Ignoring negative session expiration time");
    this.sessionExpirationTime = 0;
  }
  log.info("Will expire sessions after " + sessionExpirationTime + " minutes");
  setState(LifecycleState.STARTING);
}

代码示例来源:origin: magro/memcached-session-manager

_log.info( getClass().getSimpleName() + " starts initialization... (configured" +
    " nodes definition " + _memcachedNodes + ", failover nodes " + _failoverNodes + ")" );
_trackingHostValve = createRequestTrackingHostValve(sessionCookieName, _currentRequest);
final Context context = _manager.getContext();
context.getParent().getPipeline().addValve(_trackingHostValve);
_trackingContextValve = createRequestTrackingContextValve(sessionCookieName);
context.getPipeline().addValve( _trackingContextValve );
    _backupThreadCount, _storage, _memcachedNodesManager, _statistics );
_log.info( "--------\n- " + getClass().getSimpleName() + " finished initialization:" +
    "\n- sticky: "+ _sticky +
    "\n- operation timeout: " + _operationTimeout +

代码示例来源:origin: org.jboss.web/jbossweb

/**
 * Select the appropriate child Host to process this request,
 * based on the requested server name.  If no matching Host can
 * be found, return an appropriate HTTP error.
 *
 * @param request Request to be processed
 * @param response Response to be produced
 * @param valveContext Valve context used to forward to the next Valve
 *
 * @exception IOException if an input/output error occurred
 * @exception ServletException if a servlet error occurred
 */
public final void invoke(Request request, Response response)
  throws IOException, ServletException {
  // Select the Host to be used for this Request
  Host host = request.getHost();
  if (host == null) {
    response.sendError
      (HttpServletResponse.SC_BAD_REQUEST,
       MESSAGES.noHost(request.getServerName()));
    return;
  }
  // Ask this Host to process this request
  host.getPipeline().getFirst().invoke(request, response);
}

代码示例来源:origin: org.apache.tomcat/tomcat-catalina-ha

/**
 * register all cluster valve to host or engine
 */
protected void registerClusterValve() {
  if(container != null ) {
    for (Valve v : valves) {
      ClusterValve valve = (ClusterValve) v;
      if (log.isDebugEnabled())
        log.debug("Invoking addValve on " + getContainer()
            + " with class=" + valve.getClass().getName());
      if (valve != null) {
        container.getPipeline().addValve(valve);
        valve.setCluster(this);
      }
    }
  }
}

代码示例来源:origin: org.glassfish.main.web/web-core

this.context = context;
if (context != null) {
  this.servletContext = context.getServletContext();
  Pipeline p = context.getParent().getPipeline();
  if (p != null) {
    hostValve = p.getBasic();
      setCharacterEncoding(reqEncoding);
      getResponse().getResponse().setCharacterEncoding(resEncoding);
initSessionTracker();

代码示例来源:origin: org.apache.tomcat/tomcat-catalina-ha

/**
 * unregister all cluster valve to host or engine
 */
protected void unregisterClusterValve() {
  for (Valve v : valves) {
    ClusterValve valve = (ClusterValve) v;
    if (log.isDebugEnabled())
      log.debug("Invoking removeValve on " + getContainer()
          + " with class=" + valve.getClass().getName());
    if (valve != null) {
      container.getPipeline().removeValve(valve);
      valve.setCluster(null);
    }
  }
}

代码示例来源:origin: org.springframework.boot/spring-boot

embeddedContext.setFailCtxIfServletStartFails(true);
context.addServletContainerInitializer(starter, NO_CLASSES);
for (LifecycleListener lifecycleListener : this.contextLifecycleListeners) {
  context.addLifecycleListener(lifecycleListener);
  context.getPipeline().addValve(valve);

代码示例来源:origin: psi-probe/psi-probe

@Override
public void setWrapper(Wrapper wrapper) {
 Valve valve = createValve();
 if (wrapper != null) {
  host = (Host) wrapper.getParent().getParent();
  Engine engine = (Engine) host.getParent();
  Service service = engine.getService();
  connectors = service.findConnectors();
  try {
   deployerOName =
     new ObjectName(host.getParent().getName() + ":type=Deployer,host=" + host.getName());
  } catch (MalformedObjectNameException e) {
   logger.trace("", e);
  }
  host.getPipeline().addValve(valve);
  mbeanServer = ManagementFactory.getPlatformMBeanServer();
 } else if (host != null) {
  host.getPipeline().removeValve(valve);
 }
}

代码示例来源:origin: org.jboss.jbossas/jboss-as-tomcat

Container parent = request.getContext().getParent();
while ((sso == null) && (parent != null))
   parent = parent.getParent();
   continue;
  Valve valves[] = ((Pipeline) parent).getValves();
  for (int i = 0; i < valves.length; i++)
   parent = parent.getParent();

代码示例来源:origin: org.springframework.boot/spring-boot

private void configureEngine(Engine engine) {
  engine.setBackgroundProcessorDelay(this.backgroundProcessorDelay);
  for (Valve valve : this.engineValves) {
    engine.getPipeline().addValve(valve);
  }
}

相关文章