org.eclipse.jetty.server.Request.getHttpVersion()方法的使用及代码示例

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

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

Request.getHttpVersion介绍

暂无

代码示例

代码示例来源:origin: jphp-group/jphp

@Signature
public String httpVersion() {
  return request.getHttpVersion().asString();
}

代码示例来源:origin: org.eclipse.jetty/jetty-security

int redirectCode = (base_request.getHttpVersion().getVersion() < HttpVersion.HTTP_1_1.getVersion() ? HttpServletResponse.SC_MOVED_TEMPORARILY : HttpServletResponse.SC_SEE_OTHER);
  base_response.sendRedirect(redirectCode, response.encodeRedirectURL(nuri));
  return form_auth;
  int redirectCode = (base_request.getHttpVersion().getVersion() < HttpVersion.HTTP_1_1.getVersion() ? HttpServletResponse.SC_MOVED_TEMPORARILY : HttpServletResponse.SC_SEE_OTHER);
  base_response.sendRedirect(redirectCode, response.encodeRedirectURL(URIUtil.addPaths(request.getContextPath(),_formErrorPage)));
int redirectCode = (base_request.getHttpVersion().getVersion() < HttpVersion.HTTP_1_1.getVersion() ? HttpServletResponse.SC_MOVED_TEMPORARILY : HttpServletResponse.SC_SEE_OTHER);
base_response.sendRedirect(redirectCode, response.encodeRedirectURL(URIUtil.addPaths(request.getContextPath(),_formLoginPage)));

代码示例来源:origin: Nextdoor/bender

@Override
public String toString()
{
  return String.format("%s %d %s%n%s", _channel.getRequest().getHttpVersion(), _status, _reason == null ? "" : _reason, _fields);
}

代码示例来源:origin: jenkinsci/winstone

@Override
public String toString()
{
  return String.format("%s %d %s%n%s", _channel.getRequest().getHttpVersion(), _status, _reason == null ? "" : _reason, _fields);
}

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

@Override
public String toString()
{
  return String.format("%s %d %s%n%s", _channel.getRequest().getHttpVersion(), _status, _reason == null ? "" : _reason, _fields);
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.jetty.server

@Override
public String toString()
{
  return String.format("%s %d %s%n%s", _channel.getRequest().getHttpVersion(), _status, _reason == null ? "" : _reason, _fields);
}

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

@Override
public String toString()
{
  return String.format("%s %d %s%n%s", _channel.getRequest().getHttpVersion(), _status, _reason == null ? "" : _reason, _fields);
}

代码示例来源:origin: theonedev/onedev

@Override
public String toString()
{
  return String.format("%s %d %s%n%s", _channel.getRequest().getHttpVersion(), _status, _reason == null ? "" : _reason, _fields);
}

代码示例来源:origin: theonedev/onedev

protected MetaData.Response newResponseMetaData()
{
  return new MetaData.Response(_channel.getRequest().getHttpVersion(), getStatus(), getReason(), _fields, getLongContentLength());
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.jetty.server

protected MetaData.Response newResponseMetaData()
{
  return new MetaData.Response(_channel.getRequest().getHttpVersion(), getStatus(), getReason(), _fields, getLongContentLength());
}

代码示例来源:origin: io.airlift/http-server

@Test
public void testNoTimeToFirstByte()
    throws Exception
{
  Request request = mock(Request.class);
  Response response = mock(Response.class);
  when(request.getHttpVersion()).thenReturn(HTTP_2);
  InMemoryEventClient eventClient = new InMemoryEventClient();
  DelimitedRequestLog logger = new DelimitedRequestLog(file.getAbsolutePath(), 1, 256, Long.MAX_VALUE, null, eventClient, false);
  logger.log(request, response, 0, 0, 0, new DoubleSummaryStats(new DoubleSummaryStatistics()));
  logger.stop();
  List<Object> events = eventClient.getEvents();
  assertEquals(events.size(), 1);
  HttpRequestEvent event = (HttpRequestEvent) events.get(0);
  assertNull(event.getTimeToFirstByte());
}

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

protected ResponseInfo newResponseInfo()
{
  if (_status == HttpStatus.NOT_SET_000)
    _status = HttpStatus.OK_200;
  return new ResponseInfo(_channel.getRequest().getHttpVersion(), _fields, getLongContentLength(), getStatus(), getReason(), _channel.getRequest().isHead());
}

代码示例来源:origin: jenkinsci/winstone

protected MetaData.Response newResponseMetaData()
{
  MetaData.Response info = new MetaData.Response(_channel.getRequest().getHttpVersion(), getStatus(), getReason(), _fields, getLongContentLength());
  info.setTrailerSupplier(getTrailers());
  return info;
}

代码示例来源:origin: io.airlift/http-server

@Test
  public void testXForwardedForSkipPrivateAddresses()
      throws Exception
  {
    Request request = mock(Request.class);
    Response response = mock(Response.class);
    String clientIp = "1.1.1.1";

    when(request.getRemoteAddr()).thenReturn("9.9.9.9");
    when(request.getHeaders("X-FORWARDED-FOR")).thenReturn(Collections.enumeration(ImmutableList.of(clientIp, "192.168.1.2, 172.16.0.1", "169.254.1.2, 127.1.2.3", "10.1.2.3")));
    when(request.getHttpVersion()).thenReturn(HTTP_2);

    InMemoryEventClient eventClient = new InMemoryEventClient();
    DelimitedRequestLog logger = new DelimitedRequestLog(file.getAbsolutePath(), 1, 256, Long.MAX_VALUE, null, eventClient, false);
    logger.log(request, response, 0, 0, 0, new DoubleSummaryStats(new DoubleSummaryStatistics()));
    logger.stop();

    List<Object> events = eventClient.getEvents();
    assertEquals(events.size(), 1);
    HttpRequestEvent event = (HttpRequestEvent) events.get(0);

    assertEquals(event.getClientAddress(), clientIp);
  }
}

代码示例来源:origin: io.airlift/http-server

@Test
public void testNoXForwardedProto()
    throws Exception
{
  Request request = mock(Request.class);
  Response response = mock(Response.class);
  String protocol = "protocol";
  when(request.getScheme()).thenReturn("protocol");
  when(request.getHttpVersion()).thenReturn(HTTP_2);
  InMemoryEventClient eventClient = new InMemoryEventClient();
  DelimitedRequestLog logger = new DelimitedRequestLog(file.getAbsolutePath(), 1, 256, Long.MAX_VALUE, null, eventClient, false);
  logger.log(request, response, 0, 0, 0, new DoubleSummaryStats(new DoubleSummaryStatistics()));
  logger.stop();
  List<Object> events = eventClient.getEvents();
  assertEquals(events.size(), 1);
  HttpRequestEvent event = (HttpRequestEvent) events.get(0);
  assertEquals(event.getProtocol(), protocol);
}

代码示例来源:origin: io.airlift/http-server

@Test
public void testNoXForwardedFor()
    throws Exception
{
  Request request = mock(Request.class);
  Response response = mock(Response.class);
  String clientIp = "1.1.1.1";
  when(request.getRemoteAddr()).thenReturn(clientIp);
  when(request.getHttpVersion()).thenReturn(HTTP_2);
  InMemoryEventClient eventClient = new InMemoryEventClient();
  DelimitedRequestLog logger = new DelimitedRequestLog(file.getAbsolutePath(), 1, 256, Long.MAX_VALUE, null, eventClient, false);
  logger.log(request, response, 0, 0, 0, new DoubleSummaryStats(new DoubleSummaryStatistics()));
  logger.stop();
  List<Object> events = eventClient.getEvents();
  assertEquals(events.size(), 1);
  HttpRequestEvent event = (HttpRequestEvent) events.get(0);
  assertEquals(event.getClientAddress(), clientIp);
}

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

protected ResponseInfo newResponseInfo()
{
  if (_status == HttpStatus.NOT_SET_000)
    _status = HttpStatus.OK_200;
  return new ResponseInfo(_channel.getRequest().getHttpVersion(), _fields, getLongContentLength(), getStatus(), getReason(), _channel.getRequest().isHead());
}

代码示例来源:origin: Nextdoor/bender

protected ResponseInfo newResponseInfo()
{
  return new ResponseInfo(_channel.getRequest().getHttpVersion(), _fields, getLongContentLength(), getStatus(), getReason(), _channel.getRequest().isHead());
}

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

ResponseInfo info = new ResponseInfo(_request.getHttpVersion(), fields, 0, HttpStatus.INTERNAL_SERVER_ERROR_500, null, _request.isHead());
boolean committed = commitResponse(info, null, true);
if (!committed)

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.jetty.server

/**
 * <p>Pushes a secondary resource identified by this dispatcher.</p>
 *
 * @param request the primary request
 * @deprecated Use {@link Request#getPushBuilder()} instead
 */
@Deprecated
public void push(ServletRequest request)
{
  Request baseRequest = Request.getBaseRequest(request);
  HttpFields fields = new HttpFields(baseRequest.getHttpFields());
  String query=baseRequest.getQueryString();
  if (_uri.hasQuery())
  {
    if (query==null)
      query=_uri.getQuery();
    else
      query=query+"&"+_uri.getQuery(); // TODO is this correct semantic?
  }
  HttpURI uri = HttpURI.createHttpURI(request.getScheme(),request.getServerName(),request.getServerPort(),_uri.getPath(),baseRequest.getHttpURI().getParam(),query,null);
  MetaData.Request push = new MetaData.Request(HttpMethod.GET.asString(),uri,baseRequest.getHttpVersion(),fields);
  baseRequest.getHttpChannel().getHttpTransport().push(push);
}

相关文章

Request类方法