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

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

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

Request.getServerName介绍

暂无

代码示例

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

private URI getBaseUri(final Request request) {
  try {
    return new URI(request.getScheme(), null, request.getServerName(),
        request.getServerPort(), getBasePath(request), null, null);
  } catch (final URISyntaxException ex) {
    throw new IllegalArgumentException(ex);
  }
}

代码示例来源:origin: i2p/i2p.i2p

buf.append(request.getServerName());
buf.append(' ');

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

int port = httpConfig.getSecurePort();
String url = URIUtil.newURI(scheme, request.getServerName(), port,request.getRequestURI(),request.getQueryString());
response.setContentLength(0);
response.sendRedirect(url);

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

@Override
public StringBuffer getRequestURL()
{
  final StringBuffer url = new StringBuffer(48);
  String scheme = getScheme();
  int port = getServerPort();
  url.append(scheme);
  url.append("://");
  url.append(getServerName());
  if (_port > 0 && ((scheme.equalsIgnoreCase(URIUtil.HTTP) && port != 80) || (scheme.equalsIgnoreCase(URIUtil.HTTPS) && port != 443)))
  {
    url.append(':');
    url.append(_port);
  }
  url.append(getRequestURI());
  return url;
}

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

@Override
public StringBuffer getRequestURL()
{
  final StringBuffer url = new StringBuffer(48);
  String scheme = getScheme();
  int port = getServerPort();
  url.append(scheme);
  url.append("://");
  url.append(getServerName());
  if (_port > 0 && ((scheme.equalsIgnoreCase(URIUtil.HTTP) && port != 80) || (scheme.equalsIgnoreCase(URIUtil.HTTPS) && port != 443)))
  {
    url.append(':');
    url.append(_port);
  }
  url.append(getRequestURI());
  return url;
}

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

public StringBuffer getRequestURL()
{
  final StringBuffer url = new StringBuffer(48);
  synchronized (url)
  {
    String scheme = getScheme();
    int port = getServerPort();
    url.append(scheme);
    url.append("://");
    url.append(getServerName());
    if (_port > 0 && ((scheme.equalsIgnoreCase(URIUtil.HTTP) && port != 80) || (scheme.equalsIgnoreCase(URIUtil.HTTPS) && port != 443)))
    {
      url.append(':');
      url.append(_port);
    }
    url.append(getRequestURI());
    return url;
  }
}

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

public StringBuffer getRequestURL()
{
  final StringBuffer url = new StringBuffer(48);
  synchronized (url)
  {
    String scheme = getScheme();
    int port = getServerPort();
    url.append(scheme);
    url.append("://");
    url.append(getServerName());
    if (_port > 0 && ((scheme.equalsIgnoreCase(URIUtil.HTTP) && port != 80) || (scheme.equalsIgnoreCase(URIUtil.HTTPS) && port != 443)))
    {
      url.append(':');
      url.append(_port);
    }
    url.append(getRequestURI());
    return url;
  }
}

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-all-server

public StringBuffer getRequestURL()
{
  final StringBuffer url = new StringBuffer(48);
  synchronized (url)
  {
    String scheme = getScheme();
    int port = getServerPort();
    url.append(scheme);
    url.append("://");
    url.append(getServerName());
    if (_port > 0 && ((scheme.equalsIgnoreCase(URIUtil.HTTP) && port != 80) || (scheme.equalsIgnoreCase(URIUtil.HTTPS) && port != 443)))
    {
      url.append(':');
      url.append(_port);
    }
    url.append(getRequestURI());
    return url;
  }
}

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

public StringBuffer getRequestURL()
{
  final StringBuffer url = new StringBuffer(48);
  synchronized (url)
  {
    String scheme = getScheme();
    int port = getServerPort();
    url.append(scheme);
    url.append("://");
    url.append(getServerName());
    if (_port > 0 && ((scheme.equalsIgnoreCase(URIUtil.HTTP) && port != 80) || (scheme.equalsIgnoreCase(URIUtil.HTTPS) && port != 443)))
    {
      url.append(':');
      url.append(_port);
    }
    url.append(getRequestURI());
    return url;
  }
}

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

public StringBuffer getRequestURL()
{
  final StringBuffer url = new StringBuffer(48);
  synchronized (url)
  {
    String scheme = getScheme();
    int port = getServerPort();
    url.append(scheme);
    url.append("://");
    url.append(getServerName());
    if (_port > 0 && ((scheme.equalsIgnoreCase(URIUtil.HTTP) && port != 80) || (scheme.equalsIgnoreCase(URIUtil.HTTPS) && port != 443)))
    {
      url.append(':');
      url.append(_port);
    }
    url.append(getRequestURI());
    return url;
  }
}

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

@Override
public StringBuffer getRequestURL()
{
  final StringBuffer url = new StringBuffer(128);
  URIUtil.appendSchemeHostPort(url,getScheme(),getServerName(),getServerPort());
  url.append(getRequestURI());
  return url;
}

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

@Override
public StringBuffer getRequestURL()
{
  final StringBuffer url = new StringBuffer(128);
  URIUtil.appendSchemeHostPort(url,getScheme(),getServerName(),getServerPort());
  url.append(getRequestURI());
  return url;
}

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

@Override
public StringBuffer getRequestURL()
{
  final StringBuffer url = new StringBuffer(128);
  URIUtil.appendSchemeHostPort(url,getScheme(),getServerName(),getServerPort());
  url.append(getRequestURI());
  return url;
}

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

/**
 * Reconstructs the URL the client used to make the request. The returned URL contains a protocol, server name, port number, and, but it does not include a
 * path.
 * <p>
 * Because this method returns a <code>StringBuffer</code>, not a string, you can modify the URL easily, for example, to append path and query parameters.
 *
 * This method is useful for creating redirect messages and for reporting errors.
 *
 * @return "scheme://host:port"
 */
public StringBuilder getRootURL()
{
  StringBuilder url = new StringBuilder(128);
  URIUtil.appendSchemeHostPort(url,getScheme(),getServerName(),getServerPort());
  return url;
}

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

/**
 * Reconstructs the URL the client used to make the request. The returned URL contains a protocol, server name, port number, and, but it does not include a
 * path.
 * <p>
 * Because this method returns a <code>StringBuffer</code>, not a string, you can modify the URL easily, for example, to append path and query parameters.
 *
 * This method is useful for creating redirect messages and for reporting errors.
 *
 * @return "scheme://host:port"
 */
public StringBuilder getRootURL()
{
  StringBuilder url = new StringBuilder(128);
  URIUtil.appendSchemeHostPort(url,getScheme(),getServerName(),getServerPort());
  return url;
}

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

/**
 * Reconstructs the URL the client used to make the request. The returned URL contains a protocol, server name, port number, and, but it does not include a
 * path.
 * <p>
 * Because this method returns a <code>StringBuffer</code>, not a string, you can modify the URL easily, for example, to append path and query parameters.
 *
 * This method is useful for creating redirect messages and for reporting errors.
 *
 * @return "scheme://host:port"
 */
public StringBuilder getRootURL()
{
  StringBuilder url = new StringBuilder(128);
  URIUtil.appendSchemeHostPort(url,getScheme(),getServerName(),getServerPort());
  return url;
}

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

public int getServerPort()
{
  if (_port <= 0)
  {
    if (_serverName == null)
      getServerName();
    if (_port <= 0)
    {
      if (_serverName != null && _uri != null)
        _port = _uri.getPort();
      else
        _port = _endp == null?0:_endp.getLocalPort();
    }
  }
  if (_port <= 0)
  {
    if (getScheme().equalsIgnoreCase(URIUtil.HTTPS))
      return 443;
    return 80;
  }
  return _port;
}

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

public int getServerPort()
{
  if (_port <= 0)
  {
    if (_serverName == null)
      getServerName();
    if (_port <= 0)
    {
      if (_serverName != null && _uri != null)
        _port = _uri.getPort();
      else
        _port = _endp == null?0:_endp.getLocalPort();
    }
  }
  if (_port <= 0)
  {
    if (getScheme().equalsIgnoreCase(URIUtil.HTTPS))
      return 443;
    return 80;
  }
  return _port;
}

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-all-server

public int getServerPort()
{
  if (_port <= 0)
  {
    if (_serverName == null)
      getServerName();
    if (_port <= 0)
    {
      if (_serverName != null && _uri != null)
        _port = _uri.getPort();
      else
        _port = _endp == null?0:_endp.getLocalPort();
    }
  }
  if (_port <= 0)
  {
    if (getScheme().equalsIgnoreCase(URIUtil.HTTPS))
      return 443;
    return 80;
  }
  return _port;
}

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

public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
    if (!request.isSecure()) {
      baseRequest.getResponse().sendRedirect("https://" + baseRequest.getServerName() + ":" + httpsPort + baseRequest.getPathInfo());
      baseRequest.setHandled(true);
    } else {
      getHandler().handle(target, baseRequest, request, response);
    }

  }
}

相关文章

Request类方法