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

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

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

Request.getRequestURI介绍

[英]Return the request URI for this request.
[中]返回此请求的请求URI。

代码示例

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

@Nonnull
protected static String getURIWithQueryString( @Nonnull final Request request ) {
  final Object note = request.getNote(MSM_REQUEST_ID);
  if(note != null) {
    // we have a string and want to save cast
    return note.toString();
  }
  final StringBuilder sb = new StringBuilder(30);
  sb.append(request.getMethod())
  .append(' ')
  .append(request.getRequestURI());
  if(!isPostMethod(request) && request.getQueryString() != null) {
    sb.append('?').append(request.getQueryString());
  }
  final String result = sb.toString();
  request.setNote(MSM_REQUEST_ID, result);
  return result;
}

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

protected static boolean isPostMethod(final Request request) {
  final String method = request.getMethod();
  if ( method == null && _log.isDebugEnabled() ) {
    _log.debug("No method set for request " + request.getRequestURI() +
        (request.getQueryString() != null ? "?" + request.getQueryString() : ""));
  }
  return method != null ? method.toLowerCase().equals( "post" ) : false;
}

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

@Test
public final void testRequestFinishedShouldBeInvokedForIgnoredResources() throws IOException, ServletException {
  when( _request.getRequestedSessionId() ).thenReturn( "foo" );
  when(_request.getRequestURI()).thenReturn("/pixel.gif");
  _sessionTrackerValve.invoke( _request, _response );
  verify( _service ).requestFinished( eq( "foo" ), anyString() );
}

代码示例来源: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: jboss.web/jbossweb

public void addElement(StringBuilder buf, Date date, Request request,
      Response response, long time) {
    if (request != null) {
      buf.append(request.getRequestURI());
    } else {
      buf.append('-');
    }
  }
}

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

public void addElement(StringBuilder buf, Date date, Request request,
      Response response, long time) {
    if (request != null) {
      buf.append(request.getRequestURI());
    } else {
      buf.append('-');
    }
  }
}

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

@Override
public String getRequestURI() {
  if (request == null) {
    throw new IllegalStateException(
            sm.getString("requestFacade.nullRequest"));
  }
  return request.getRequestURI();
}

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

@Override
public String getRequestURI() {
  if (request == null) {
    throw new IllegalStateException(
            sm.getString("requestFacade.nullRequest"));
  }
  return request.getRequestURI();
}

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

public String getRequestURI() {
  if (request == null) {
    throw new IllegalStateException(
            sm.getString("requestFacade.nullRequest"));
  }
  return request.getRequestURI();
}

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

public String getRequestURI() {
  if (request == null) {
    throw new IllegalStateException(
            sm.getString("requestFacade.nullRequest"));
  }
  return request.getRequestURI();
}

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

@Override
public String getRequestURI() {
  if (request == null) {
    throw new IllegalStateException(
            sm.getString("requestFacade.nullRequest"));
  }
  return request.getRequestURI();
}

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

@Override
  public void addElement(CharArrayWriter buf, Date date, Request request,
      Response response, long time) {
    if (request != null) {
      buf.append(request.getRequestURI());
    } else {
      buf.append('-');
    }
  }
}

代码示例来源:origin: apereo/java-cas-client

public void invoke(final Request request, final Response response) throws IOException, ServletException {
    if (this.proxyCallbackUrl.equals(request.getRequestURI())) {
      logger.debug("Processing proxy callback request.");
      CommonUtils.readAndRespondToProxyReceptorRequest(request, response, PROXY_GRANTING_TICKET_STORAGE);
      return;
    }

    getNext().invoke(request, response);
  }
}

代码示例来源:origin: apereo/java-cas-client

public void invoke(final Request request, final Response response) throws IOException, ServletException {
    if (this.proxyCallbackUrl.equals(request.getRequestURI())) {
      logger.debug("Processing proxy callback request.");
      CommonUtils.readAndRespondToProxyReceptorRequest(request, response, PROXY_GRANTING_TICKET_STORAGE);
      return;
    }

    getNext().invoke(request, response);
  }
}

代码示例来源:origin: apereo/java-cas-client

public void invoke(final Request request, final Response response) throws IOException, ServletException {
  if (this.proxyCallbackUrl.equals(request.getRequestURI())) {
    logger.debug("Processing proxy callback request.");
    CommonUtils.readAndRespondToProxyReceptorRequest(request, response, PROXY_GRANTING_TICKET_STORAGE);
    return;
  }
  getNext().invoke(request, response);
}

代码示例来源:origin: apereo/java-cas-client

public void invoke(final Request request, final Response response) throws IOException, ServletException {
    if (this.proxyCallbackUrl.equals(request.getRequestURI())) {
      logger.debug("Processing proxy callback request.");
      CommonUtils.readAndRespondToProxyReceptorRequest(request, response, PROXY_GRANTING_TICKET_STORAGE);
      return;
    }

    getNext().invoke(request, response);
  }
}

代码示例来源:origin: apereo/java-cas-client

public final void invoke(final Request request, final Response response) throws IOException, ServletException {
  if (getLogoutHandler().isLogoutRequest(request)) {
    getLogoutHandler().logout(request, response);
    // Do not proceed up valve chain
    return;
  }
  logger.debug("URI is not a logout request: {}", request.getRequestURI());
  getNext().invoke(request, response);
}

代码示例来源:origin: apereo/java-cas-client

public final void invoke(final Request request, final Response response) throws IOException, ServletException {
  if (getLogoutHandler().isLogoutRequest(request)) {
    getLogoutHandler().logout(request, response);
    // Do not proceed up valve chain
    return;
  }
  logger.debug("URI is not a logout request: {}", request.getRequestURI());
  getNext().invoke(request, response);
}

代码示例来源:origin: apereo/java-cas-client

public final void invoke(final Request request, final Response response) throws IOException, ServletException {
  if (getLogoutHandler().isLogoutRequest(request)) {
    getLogoutHandler().logout(request, response);
    // Do not proceed up valve chain
    return;
  }
  logger.debug("URI is not a logout request: {}", request.getRequestURI());
  getNext().invoke(request, response);
}

代码示例来源:origin: apereo/java-cas-client

public final void invoke(final Request request, final Response response) throws IOException, ServletException {
  if (getLogoutHandler().isLogoutRequest(request)) {
    getLogoutHandler().logout(request, response);
    // Do not proceed up valve chain
    return;
  }
  logger.debug("URI is not a logout request: {}", request.getRequestURI());
  getNext().invoke(request, response);
}

相关文章

Request类方法