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

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

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

Request.getContext介绍

[英]Return the Context within which this Request is being processed.
[中]返回处理此请求的上下文。

代码示例

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

@Override
public void invoke(Request request, Response response) throws IOException, ServletException {
 // Get the Manager
 Manager manager = request.getContext().getManager();
 // If it is an AbstractManager, handle possible failover
 if (manager instanceof DeltaSessionManager) {
  DeltaSessionManager absMgr = (DeltaSessionManager) manager;
  String localJvmRoute = absMgr.getJvmRoute();
  if (localJvmRoute != null) {
   handlePossibleFailover(request, absMgr, localJvmRoute);
  }
 }
 // Invoke the next Valve
 getNext().invoke(request, response);
}

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

@Override
public void invoke(Request request, Response response) throws IOException, ServletException {
  String sessionId = request.getRequestedSessionId();
  Session session = request.getContext().getManager().findSession(sessionId);
  if (session != null) {
    if (!session.isValid()) {
      session.expire();
      request.getContext().getManager().remove(session);
    } else {
      manager.add(session);
      session.access();
      session.endAccess();
    }
  }
  
  try {
    getNext().invoke(request, response);
  } finally {
    manager.store(request.getSession(false));
  }
}

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

@Override
public void invoke(Request request, Response response) throws IOException, ServletException {
  String sessionId = request.getRequestedSessionId();
  Session session = request.getContext().getManager().findSession(sessionId);
  if (session != null) {
    if (!session.isValid()) {
      session.expire();
      request.getContext().getManager().remove(session);
    } else {
      manager.add(session);
      session.access();
      session.endAccess();
    }
  }
  
  try {
    getNext().invoke(request, response);
  } finally {
    manager.store(request.getSession(false));
  }
}

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

@Override
public void invoke(Request request, Response response) throws IOException, ServletException {
  String sessionId = request.getRequestedSessionId();
  Session session = request.getContext().getManager().findSession(sessionId);
  if (session != null) {
    if (!session.isValid()) {
      session.expire();
      request.getContext().getManager().remove(session);
    } else {
      manager.add(session);
      session.access();
      session.endAccess();
    }
  }
  
  try {
    getNext().invoke(request, response);
  } finally {
    manager.store(request.getSession(false));
  }
}

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

@Override
public void invoke(Request request, Response response) throws IOException, ServletException {
  String sessionId = request.getRequestedSessionId();
  Session session = request.getContext().getManager().findSession(sessionId);
  if (session != null) {
    if (!session.isValid()) {
      session.expire();
      request.getContext().getManager().remove(session);
    } else {
      manager.add(session);
      session.access();
      session.endAccess();
    }
  }
  
  try {
    getNext().invoke(request, response);
  } finally {
    manager.store(request.getSession(false));
  }
}

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

@Override
public void invoke(Request request, Response response) throws IOException, ServletException {
 Manager manager = request.getContext().getManager();
 DeltaSessionFacade session = null;

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

@BeforeMethod
public void setUp() throws Exception {
  _service = mock( MemcachedSessionService.class );
  _request = mock( Request.class );
  _response = mock( Response.class );
  final Context _contextContainer = mock(Context.class);
  final Host _hostContainer = mock(Host.class);
  final SessionManager _manager = mock(SessionManager.class);
  when(_service.getManager()).thenReturn(_manager);
  when(_manager.getContext()).thenReturn(_contextContainer);
  when(_contextContainer.getParent()).thenReturn(_hostContainer);
  when(_contextContainer.getPath()).thenReturn("/");
  _sessionTrackerValve = createSessionTrackerValve();
  _nextValve = mock( Valve.class );
  _sessionTrackerValve.setNext( _nextValve );
  _sessionTrackerValve.setContainer(_hostContainer);
  when(_request.getRequestURI()).thenReturn( "/someRequest");
  when(_request.getMethod()).thenReturn("GET");
  when(_request.getQueryString()).thenReturn(null);
  when(_request.getContext()).thenReturn(_contextContainer);
  when(_request.getNote(eq(RequestTrackingHostValve.REQUEST_PROCESSED))).thenReturn(Boolean.TRUE);
  when(_request.getNote(eq(RequestTrackingHostValve.SESSION_ID_CHANGED))).thenReturn(Boolean.FALSE);
}

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

/**
 * @return the Context within which this Request is being processed.
 */
public Context getContext() {
  return request.getContext();
}

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

/**
 * Return the Context within which this Request is being processed.
 */
public Context getContext() {
  return (request.getContext());
}

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

/**
 * Return the Context within which this Request is being processed.
 */
public Context getContext() {
  return (request.getContext());
}

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

/**
 * Return the Context within which this Request is being processed.
 */
public Context getContext() {
  return (request.getContext());
}

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

if(!_enabled.get() || !_msmContext.equals(request.getContext())) {
  getNext().invoke( request, response );
} else if ( _ignorePattern != null && _ignorePattern.matcher( requestId ).matches() ) {

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

@Override
public ServletContext getServletContext() {
  return getContext().getServletContext();
 }

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

/**
 * {@inheritDoc}
 */
@Override
public boolean authenticate(HttpServletResponse response)
throws IOException, ServletException {
  if (response.isCommitted()) {
    throw new IllegalStateException(
        sm.getString("coyoteRequest.authenticate.ise"));
  }
  return getContext().getAuthenticator().authenticate(this, response);
}

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

/**
 * {@inheritDoc}
 */
@Override
public void logout() throws ServletException {
  getContext().getAuthenticator().logout(this);
}

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

/**
 * Check the configuration for aborted uploads and if configured to do so,
 * disable the swallowing of any remaining input and close the connection
 * once the response has been written.
 */
protected void checkSwallowInput() {
  Context context = getContext();
  if (context != null && !context.getSwallowAbortedUploads()) {
    coyoteRequest.action(ActionCode.DISABLE_SWALLOW_INPUT, null);
  }
}

代码示例来源:origin: org.keycloak/spring-boot-container-bundle

/**
 * Method called by Tomcat < 8.5.5
 */
public boolean authenticate(Request request, HttpServletResponse response) throws IOException {
  return authenticateInternal(request, response, request.getContext().getLoginConfig());
}

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

/**
 * Check the configuration for aborted uploads and if configured to do so,
 * disable the swallowing of any remaining input and close the connection
 * once the response has been written.
 */
protected void checkSwallowInput() {
  Context context = getContext();
  if (context != null && !context.getSwallowAbortedUploads()) {
    coyoteRequest.action(ActionCode.DISABLE_SWALLOW_INPUT, null);
  }
}

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

@Override
  public void addElement(CharArrayWriter buf, Date date, Request request,
      Response response, long time) {
    buf.append(wrap(request.getContext().getServletContext()
        .getAttribute(attribute)));
  }
}

代码示例来源:origin: org.nuxeo.lib.runtime/nuxeo-runtime-tomcat-adapter

private void getReload(Request req, Response resp) {
  ClassLoader webLoader = req.getContext().getLoader().getClassLoader();
  if (webLoader instanceof NuxeoDevWebappClassLoader) {
    NuxeoDevWebappClassLoader loader = (NuxeoDevWebappClassLoader) webLoader;
    // only if dev.bundles was modified
    loader.getBootstrap().loadDevBundles();
    // log.error("###### reloaded dev bundles");
  }
  resp.setStatus(200);
}

相关文章

Request类方法