org.apache.catalina.connector.Request.getWrapper()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(10.5k)|赞(0)|评价(0)|浏览(164)

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

Request.getWrapper介绍

[英]Return the Wrapper within which this Request is being processed.
[中]返回处理此请求的包装器。

代码示例

代码示例来源:origin: org.glassfish.main.security/websecurity

public Wrapper getWrapper() {
  return httpRequest.getWrapper();
}

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

public void enter() {
  if (securityService != null && request.getWrapper() != null) {
    oldState = securityService.enterWebApp(request.getWrapper().getRealm(), request.getPrincipal(), request.getWrapper().getRunAs());
  }
}

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

public void enter() {
  if (securityService != null && request.getWrapper() != null) {
    oldState = securityService.enterWebApp(request.getWrapper().getRealm(), request.getPrincipal(), request.getWrapper().getRunAs());
  }
}

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

private void updateWrapperErrorCount(Request request, Response response) {
  if (response.isError()) {
    Wrapper wrapper = request.getWrapper();
    if (wrapper != null) {
      wrapper.incrementErrorCount();
    }
  }
}

代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

private void updateWrapperErrorCount(Request request, Response response) {
  if (response.isError()) {
    Wrapper wrapper = request.getWrapper();
    if (wrapper != null) {
      wrapper.incrementErrorCount();
    }
  }
}

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

public void invoke(Request request, Response response) throws IOException, ServletException {
  Object oldState = null;
  if (securityService != null && request.getWrapper() != null) {
    oldState = securityService.enterWebApp(request.getWrapper().getRealm(), request.getPrincipal(), request.getWrapper().getRunAs());
  }
  try {
    getNext().invoke(request, response);
  } finally {
    if (securityService != null) {
      securityService.exitWebApp(oldState);
    }
  }
}

代码示例来源:origin: apache/flex-blazeds

public boolean authorize(Principal principal, List roles)
{
  Realm realm = valve.getContainer().getRealm();
  Iterator iter = roles.iterator();
  while (iter.hasNext())
  {
    String role = (String)iter.next();
    // For Tomcat 7, we need to get the wrapper from the request to support role mapping in the web.xml.
    // This is only supported for servlet endpoints. For NIO endpoints, the wrapper will be null.
    Wrapper wrapper = null;
    if (request != null)
    {
      // in the servlet case get the wrapper
      wrapper = request.getWrapper();
    }
    // for nio the wrapper will be null
    if (realm.hasRole(wrapper, principal, role))
      return true;
  }
  return false;
}

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

public void sessionDestroyed(HttpSessionEvent se) {
  // Close all Comet connections associated with this session
  Request[] reqs = (Request[])
    se.getSession().getAttribute(cometRequestsAttribute);
  if (reqs != null) {
    for (int i = 0; i < reqs.length; i++) {
      Request req = reqs[i];
      try {
        req.getEvent().close();
      } catch (Exception e) {
        req.getWrapper().getParent().getLogger().warn(MESSAGES.eventValveSessionListenerException(), e);
      }
    }
  }
}

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

public void sessionDestroyed(HttpSessionEvent se) {
  // Close all Comet connections associated with this session
  Request[] reqs = (Request[])
    se.getSession().getAttribute(cometRequestsAttribute);
  if (reqs != null) {
    for (int i = 0; i < reqs.length; i++) {
      Request req = reqs[i];
      try {
        req.getEvent().close();
      } catch (Exception e) {
        req.getWrapper().getParent().getLogger().warn(sm.getString(
            "cometConnectionManagerValve.listenerEvent"), e);
      }
    }
  }
}

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

/**
 * Select the appropriate child Wrapper to process this request,
 * based on the specified request URI.  If no matching Wrapper 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 event(Request request, Response response, HttpEvent httpEvent)
  throws IOException, ServletException {
  // Select the Wrapper to be used for this Request
  Wrapper wrapper = request.getWrapper();
  wrapper.getPipeline().getFirst().event(request, response, httpEvent);
}

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

/**
   * Select the appropriate child Wrapper to process this request,
   * based on the specified request URI.  If no matching Wrapper can
   * be found, return an appropriate HTTP error.
   *
   * @param request Request to be processed
   * @param response Response to be produced
   * @param event
   *
   * @exception IOException if an input/output error occurred
   * @exception ServletException if a servlet error occurred
   */
  @Override
  public final void event(Request request, Response response, CometEvent event)
    throws IOException, ServletException {

    // Select the Wrapper to be used for this Request
    Wrapper wrapper = request.getWrapper();

    wrapper.getPipeline().getFirst().event(request, response, event);
  }
}

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

/**
   * Select the appropriate child Wrapper to process this request,
   * based on the specified request URI.  If no matching Wrapper can
   * be found, return an appropriate HTTP error.
   *
   * @param request Request to be processed
   * @param response Response to be produced
   * @param event
   *
   * @exception IOException if an input/output error occurred
   * @exception ServletException if a servlet error occurred
   */
  @Override
  public final void event(Request request, Response response, CometEvent event)
    throws IOException, ServletException {

    // Select the Wrapper to be used for this Request
    Wrapper wrapper = request.getWrapper();

    wrapper.getPipeline().getFirst().event(request, response, event);
  }
}

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

/**
   * Select the appropriate child Wrapper to process this request,
   * based on the specified request URI.  If no matching Wrapper can
   * be found, return an appropriate HTTP error.
   *
   * @param request Request to be processed
   * @param response Response to be produced
   * @param event
   *
   * @exception IOException if an input/output error occurred
   * @exception ServletException if a servlet error occurred
   */
  @Override
  public final void event(Request request, Response response, CometEvent event)
    throws IOException, ServletException {

    // Select the Wrapper to be used for this Request
    Wrapper wrapper = request.getWrapper();

    wrapper.getPipeline().getFirst().event(request, response, event);
  }
}

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

private Set<String> getNonAsyncClassNames() {
  Set<String> result = new HashSet<>();
  Wrapper wrapper = getWrapper();
  if (!wrapper.isAsyncSupported()) {
    result.add(wrapper.getServletClass());
  }
  FilterChain filterChain = getFilterChain();
  if (filterChain instanceof ApplicationFilterChain) {
    ((ApplicationFilterChain) filterChain).findNonAsyncFilters(result);
  } else {
    result.add(sm.getString("coyoteRequest.filterAsyncSupportUnknown"));
  }
  Container c = wrapper;
  while (c != null) {
    c.getPipeline().findNonAsyncValves(result);
    c = c.getParent();
  }
  return result;
}

代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

private Set<String> getNonAsyncClassNames() {
  Set<String> result = new HashSet<>();
  Wrapper wrapper = getWrapper();
  if (!wrapper.isAsyncSupported()) {
    result.add(wrapper.getServletClass());
  }
  FilterChain filterChain = getFilterChain();
  if (filterChain instanceof ApplicationFilterChain) {
    ((ApplicationFilterChain) filterChain).findNonAsyncFilters(result);
  } else {
    result.add(sm.getString("coyoteRequest.filterAsyncSupportUnknown"));
  }
  Container c = wrapper;
  while (c != null) {
    c.getPipeline().findNonAsyncValves(result);
    c = c.getParent();
  }
  return result;
}

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

@Override
public void sessionDestroyed(HttpSessionEvent se) {
  // Close all Comet connections associated with this session
  Request[] reqs = (Request[])
    se.getSession().getAttribute(cometRequestsAttribute);
  if (reqs != null) {
    for (int i = 0; i < reqs.length; i++) {
      Request req = reqs[i];
      try {
        CometEventImpl event = req.getEvent();
        event.setEventType(CometEvent.EventType.END);
        event.setEventSubType(CometEvent.EventSubType.SESSION_END);
        ((CometProcessor)
            req.getWrapper().getServlet()).event(event);
        event.close();
      } catch (Exception e) {
        req.getWrapper().getParent().getLogger().warn(sm.getString(
            "cometConnectionManagerValve.listenerEvent"), e);
      }
    }
  }
}

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

@Override
public void sessionDestroyed(HttpSessionEvent se) {
  // Close all Comet connections associated with this session
  Request[] reqs = (Request[])
    se.getSession().getAttribute(cometRequestsAttribute);
  if (reqs != null) {
    for (int i = 0; i < reqs.length; i++) {
      Request req = reqs[i];
      try {
        CometEventImpl event = req.getEvent();
        event.setEventType(CometEvent.EventType.END);
        event.setEventSubType(CometEvent.EventSubType.SESSION_END);
        ((CometProcessor)
            req.getWrapper().getServlet()).event(event);
        event.close();
      } catch (Exception e) {
        req.getWrapper().getParent().getLogger().warn(sm.getString(
            "cometConnectionManagerValve.listenerEvent"), e);
      }
    }
  }
}

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

@Override
public void sessionDestroyed(HttpSessionEvent se) {
  // Close all Comet connections associated with this session
  Request[] reqs = (Request[])
    se.getSession().getAttribute(cometRequestsAttribute);
  if (reqs != null) {
    for (int i = 0; i < reqs.length; i++) {
      Request req = reqs[i];
      try {
        CometEventImpl event = req.getEvent();
        event.setEventType(CometEvent.EventType.END);
        event.setEventSubType(CometEvent.EventSubType.SESSION_END);
        ((CometProcessor)
            req.getWrapper().getServlet()).event(event);
        event.close();
      } catch (Exception e) {
        req.getWrapper().getParent().getLogger().warn(sm.getString(
            "cometConnectionManagerValve.listenerEvent"), e);
      }
    }
  }
}

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

@Override
public void sessionDestroyed(HttpSessionEvent se) {
  // Close all Comet connections associated with this session
  Request[] reqs = (Request[])
    se.getSession().getAttribute(cometRequestsAttribute);
  if (reqs != null) {
    for (int i = 0; i < reqs.length; i++) {
      Request req = reqs[i];
      try {
        CometEventImpl event = req.getEvent();
        event.setEventType(CometEvent.EventType.END);
        event.setEventSubType(CometEvent.EventSubType.SESSION_END);
        ((CometProcessor)
            req.getWrapper().getServlet()).event(event);
        event.close();
      } catch (Exception e) {
        req.getWrapper().getParent().getLogger().warn(sm.getString(
            "cometConnectionManagerValve.listenerEvent"), e);
      }
    }
  }
}

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

@Override
public void sessionDestroyed(HttpSessionEvent se) {
  // Close all Comet connections associated with this session
  Request[] reqs = (Request[])
    se.getSession().getAttribute(cometRequestsAttribute);
  if (reqs != null) {
    for (int i = 0; i < reqs.length; i++) {
      Request req = reqs[i];
      try {
        CometEventImpl event = req.getEvent();
        event.setEventType(CometEvent.EventType.END);
        event.setEventSubType(CometEvent.EventSubType.SESSION_END);
        ((CometProcessor)
            req.getWrapper().getServlet()).event(event);
        event.close();
      } catch (Exception e) {
        req.getWrapper().getParent().getLogger().warn(sm.getString(
            "cometConnectionManagerValve.listenerEvent"), e);
      }
    }
  }
}

相关文章

Request类方法