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

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

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

Request.getMethod介绍

[英]Return the HTTP request method used in this Request.
[中]返回此请求中使用的HTTP请求方法。

代码示例

代码示例来源: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

@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.getMethod());
    }
  }
}

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

@Override
  public void addElement(StringBuilder buf, Date date, Request request,
      Response response, long time) {
    if (request != null) {
      buf.append(request.getMethod());
    }
  }
}

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

@Override
  public void addElement(StringBuilder buf, Date date, Request request,
      Response response, long time) {
    if (request != null) {
      buf.append(request.getMethod());
    }
  }
}

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

@Override
  public void addElement(StringBuilder buf, Date date, Request request,
      Response response, long time) {
    if (request != null) {
      buf.append(request.getMethod());
    }
  }
}

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

@Override
  public void addElement(StringBuilder buf, Date date, Request request,
      Response response, long time) {
    if (request != null) {
      buf.append(request.getMethod());
    }
  }
}

代码示例来源: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.getMethod());
    }
  }
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

代码示例来源:origin: com.springsource.insight/insight-collection-tcserver

String makeOperationLabel(Request request) {
  String queryString = request.getQueryString();
  queryString = queryString == null ? "" : ("?" + queryString);
  return request.getMethod() + " " + request.getRequestURI() + queryString; 
}

相关文章

Request类方法