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

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

本文整理了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

  1. private URI getBaseUri(final Request request) {
  2. try {
  3. return new URI(request.getScheme(), null, request.getServerName(),
  4. request.getServerPort(), getBasePath(request), null, null);
  5. } catch (final URISyntaxException ex) {
  6. throw new IllegalArgumentException(ex);
  7. }
  8. }

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

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

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

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

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

  1. @Override
  2. public StringBuffer getRequestURL()
  3. {
  4. final StringBuffer url = new StringBuffer(48);
  5. String scheme = getScheme();
  6. int port = getServerPort();
  7. url.append(scheme);
  8. url.append("://");
  9. url.append(getServerName());
  10. if (_port > 0 && ((scheme.equalsIgnoreCase(URIUtil.HTTP) && port != 80) || (scheme.equalsIgnoreCase(URIUtil.HTTPS) && port != 443)))
  11. {
  12. url.append(':');
  13. url.append(_port);
  14. }
  15. url.append(getRequestURI());
  16. return url;
  17. }

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

  1. @Override
  2. public StringBuffer getRequestURL()
  3. {
  4. final StringBuffer url = new StringBuffer(48);
  5. String scheme = getScheme();
  6. int port = getServerPort();
  7. url.append(scheme);
  8. url.append("://");
  9. url.append(getServerName());
  10. if (_port > 0 && ((scheme.equalsIgnoreCase(URIUtil.HTTP) && port != 80) || (scheme.equalsIgnoreCase(URIUtil.HTTPS) && port != 443)))
  11. {
  12. url.append(':');
  13. url.append(_port);
  14. }
  15. url.append(getRequestURI());
  16. return url;
  17. }

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

  1. public StringBuffer getRequestURL()
  2. {
  3. final StringBuffer url = new StringBuffer(48);
  4. synchronized (url)
  5. {
  6. String scheme = getScheme();
  7. int port = getServerPort();
  8. url.append(scheme);
  9. url.append("://");
  10. url.append(getServerName());
  11. if (_port > 0 && ((scheme.equalsIgnoreCase(URIUtil.HTTP) && port != 80) || (scheme.equalsIgnoreCase(URIUtil.HTTPS) && port != 443)))
  12. {
  13. url.append(':');
  14. url.append(_port);
  15. }
  16. url.append(getRequestURI());
  17. return url;
  18. }
  19. }

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

  1. public StringBuffer getRequestURL()
  2. {
  3. final StringBuffer url = new StringBuffer(48);
  4. synchronized (url)
  5. {
  6. String scheme = getScheme();
  7. int port = getServerPort();
  8. url.append(scheme);
  9. url.append("://");
  10. url.append(getServerName());
  11. if (_port > 0 && ((scheme.equalsIgnoreCase(URIUtil.HTTP) && port != 80) || (scheme.equalsIgnoreCase(URIUtil.HTTPS) && port != 443)))
  12. {
  13. url.append(':');
  14. url.append(_port);
  15. }
  16. url.append(getRequestURI());
  17. return url;
  18. }
  19. }

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

  1. public StringBuffer getRequestURL()
  2. {
  3. final StringBuffer url = new StringBuffer(48);
  4. synchronized (url)
  5. {
  6. String scheme = getScheme();
  7. int port = getServerPort();
  8. url.append(scheme);
  9. url.append("://");
  10. url.append(getServerName());
  11. if (_port > 0 && ((scheme.equalsIgnoreCase(URIUtil.HTTP) && port != 80) || (scheme.equalsIgnoreCase(URIUtil.HTTPS) && port != 443)))
  12. {
  13. url.append(':');
  14. url.append(_port);
  15. }
  16. url.append(getRequestURI());
  17. return url;
  18. }
  19. }

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

  1. public StringBuffer getRequestURL()
  2. {
  3. final StringBuffer url = new StringBuffer(48);
  4. synchronized (url)
  5. {
  6. String scheme = getScheme();
  7. int port = getServerPort();
  8. url.append(scheme);
  9. url.append("://");
  10. url.append(getServerName());
  11. if (_port > 0 && ((scheme.equalsIgnoreCase(URIUtil.HTTP) && port != 80) || (scheme.equalsIgnoreCase(URIUtil.HTTPS) && port != 443)))
  12. {
  13. url.append(':');
  14. url.append(_port);
  15. }
  16. url.append(getRequestURI());
  17. return url;
  18. }
  19. }

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

  1. public StringBuffer getRequestURL()
  2. {
  3. final StringBuffer url = new StringBuffer(48);
  4. synchronized (url)
  5. {
  6. String scheme = getScheme();
  7. int port = getServerPort();
  8. url.append(scheme);
  9. url.append("://");
  10. url.append(getServerName());
  11. if (_port > 0 && ((scheme.equalsIgnoreCase(URIUtil.HTTP) && port != 80) || (scheme.equalsIgnoreCase(URIUtil.HTTPS) && port != 443)))
  12. {
  13. url.append(':');
  14. url.append(_port);
  15. }
  16. url.append(getRequestURI());
  17. return url;
  18. }
  19. }

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

  1. @Override
  2. public StringBuffer getRequestURL()
  3. {
  4. final StringBuffer url = new StringBuffer(128);
  5. URIUtil.appendSchemeHostPort(url,getScheme(),getServerName(),getServerPort());
  6. url.append(getRequestURI());
  7. return url;
  8. }

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

  1. @Override
  2. public StringBuffer getRequestURL()
  3. {
  4. final StringBuffer url = new StringBuffer(128);
  5. URIUtil.appendSchemeHostPort(url,getScheme(),getServerName(),getServerPort());
  6. url.append(getRequestURI());
  7. return url;
  8. }

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

  1. @Override
  2. public StringBuffer getRequestURL()
  3. {
  4. final StringBuffer url = new StringBuffer(128);
  5. URIUtil.appendSchemeHostPort(url,getScheme(),getServerName(),getServerPort());
  6. url.append(getRequestURI());
  7. return url;
  8. }

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

  1. /**
  2. * 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
  3. * path.
  4. * <p>
  5. * 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.
  6. *
  7. * This method is useful for creating redirect messages and for reporting errors.
  8. *
  9. * @return "scheme://host:port"
  10. */
  11. public StringBuilder getRootURL()
  12. {
  13. StringBuilder url = new StringBuilder(128);
  14. URIUtil.appendSchemeHostPort(url,getScheme(),getServerName(),getServerPort());
  15. return url;
  16. }

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

  1. /**
  2. * 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
  3. * path.
  4. * <p>
  5. * 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.
  6. *
  7. * This method is useful for creating redirect messages and for reporting errors.
  8. *
  9. * @return "scheme://host:port"
  10. */
  11. public StringBuilder getRootURL()
  12. {
  13. StringBuilder url = new StringBuilder(128);
  14. URIUtil.appendSchemeHostPort(url,getScheme(),getServerName(),getServerPort());
  15. return url;
  16. }

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

  1. /**
  2. * 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
  3. * path.
  4. * <p>
  5. * 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.
  6. *
  7. * This method is useful for creating redirect messages and for reporting errors.
  8. *
  9. * @return "scheme://host:port"
  10. */
  11. public StringBuilder getRootURL()
  12. {
  13. StringBuilder url = new StringBuilder(128);
  14. URIUtil.appendSchemeHostPort(url,getScheme(),getServerName(),getServerPort());
  15. return url;
  16. }

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

  1. public int getServerPort()
  2. {
  3. if (_port <= 0)
  4. {
  5. if (_serverName == null)
  6. getServerName();
  7. if (_port <= 0)
  8. {
  9. if (_serverName != null && _uri != null)
  10. _port = _uri.getPort();
  11. else
  12. _port = _endp == null?0:_endp.getLocalPort();
  13. }
  14. }
  15. if (_port <= 0)
  16. {
  17. if (getScheme().equalsIgnoreCase(URIUtil.HTTPS))
  18. return 443;
  19. return 80;
  20. }
  21. return _port;
  22. }

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

  1. public int getServerPort()
  2. {
  3. if (_port <= 0)
  4. {
  5. if (_serverName == null)
  6. getServerName();
  7. if (_port <= 0)
  8. {
  9. if (_serverName != null && _uri != null)
  10. _port = _uri.getPort();
  11. else
  12. _port = _endp == null?0:_endp.getLocalPort();
  13. }
  14. }
  15. if (_port <= 0)
  16. {
  17. if (getScheme().equalsIgnoreCase(URIUtil.HTTPS))
  18. return 443;
  19. return 80;
  20. }
  21. return _port;
  22. }

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

  1. public int getServerPort()
  2. {
  3. if (_port <= 0)
  4. {
  5. if (_serverName == null)
  6. getServerName();
  7. if (_port <= 0)
  8. {
  9. if (_serverName != null && _uri != null)
  10. _port = _uri.getPort();
  11. else
  12. _port = _endp == null?0:_endp.getLocalPort();
  13. }
  14. }
  15. if (_port <= 0)
  16. {
  17. if (getScheme().equalsIgnoreCase(URIUtil.HTTPS))
  18. return 443;
  19. return 80;
  20. }
  21. return _port;
  22. }

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

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

相关文章

Request类方法