public StringBuffer getRequestURL() { 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; } }
/** * 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 StringBuffer getRootURL() { 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("http") && port != 80) || (scheme.equalsIgnoreCase("https") && port != 443))) { url.append(':'); url.append(port); } return url; } }
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; }
private String formatEntry(Request request, Response response) { StringBuilder buf = new StringBuilder(); buf.append(request.getServerName()); buf.append(' ');
buf.append(request.getServerName()); buf.append(' ');
session.setAttribute(__J_URI, request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + URIUtil.addPaths(request.getContextPath(),uri));
session.setAttribute(__J_URI, request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + URIUtil.addPaths(request.getContextPath(),uri));
connector.getIntegralScheme() + "://" + request.getServerName() + ":" + connector.getIntegralPort() connector.getConfidentialScheme() + "://" + request.getServerName() + ":" + connector.getConfidentialPort()
connector.getIntegralScheme() + "://" + request.getServerName() + ":" + connector.getIntegralPort() connector.getConfidentialScheme() + "://" + request.getServerName() + ":" + connector.getConfidentialPort()