String host = getXForwardedHeader(req, "X-Forwarded-Host", req.getServerName()); int index = host.indexOf(':'); int port = req.getServerPort(); if (index == -1) {
public String getFullUrl() { StringBuilder buf = new StringBuilder(); StaplerRequest req = Stapler.getCurrentRequest(); buf.append(req.getScheme()); buf.append("://"); buf.append(req.getServerName()); if(req.getServerPort()!=80) buf.append(':').append(req.getServerPort()); buf.append(getUrl()); return buf.toString(); }
public String getFullUrl() { StringBuilder buf = new StringBuilder(); StaplerRequest req = Stapler.getCurrentRequest(); buf.append(req.getScheme()); buf.append("://"); buf.append(req.getServerName()); if(req.getServerPort()!=80) buf.append(':').append(req.getServerPort()); buf.append(getUrl()); return buf.toString(); }
public String getFullUrl() { StringBuilder buf = new StringBuilder(); StaplerRequest req = Stapler.getCurrentRequest(); buf.append(req.getScheme()); buf.append("://"); buf.append(req.getServerName()); if(req.getServerPort()!=80) buf.append(':').append(req.getServerPort()); buf.append(getUrl()); return buf.toString(); }
/** * Gets the absolute URL of Hudson top page, such as "http://localhost/hudson/". * * <p> * Unlike {@link #getRootUrl()}, which uses the manually configured value, * this one uses the current request to reconstruct the URL. The benefit is * that this is immune to the configuration mistake (users often fail to set the root URL * correctly, especially when a migration is involved), but the downside * is that unless you are processing a request, this method doesn't work. * * @since 1.263 */ public String getRootUrlFromRequest() { StaplerRequest req = Stapler.getCurrentRequest(); StringBuilder buf = new StringBuilder(); buf.append(req.getScheme() + "://"); buf.append(req.getServerName()); if (req.getServerPort() != 80) { buf.append(':').append(req.getServerPort()); } buf.append(req.getContextPath()).append('/'); return buf.toString(); }
/** * Gets the absolute URL of Hudson top page, such as "http://localhost/hudson/". * * <p> * Unlike {@link #getRootUrl()}, which uses the manually configured value, * this one uses the current request to reconstruct the URL. The benefit is * that this is immune to the configuration mistake (users often fail to set the root URL * correctly, especially when a migration is involved), but the downside * is that unless you are processing a request, this method doesn't work. * * @since 1.263 */ public String getRootUrlFromRequest() { StaplerRequest req = Stapler.getCurrentRequest(); StringBuilder buf = new StringBuilder(); buf.append(req.getScheme() + "://"); buf.append(req.getServerName()); if (req.getServerPort() != 80) { buf.append(':').append(req.getServerPort()); } buf.append(req.getContextPath()).append('/'); return buf.toString(); }
/** * Gets the absolute URL of Hudson top page, such as "http://localhost/hudson/". * * <p> * Unlike {@link #getRootUrl()}, which uses the manually configured value, * this one uses the current request to reconstruct the URL. The benefit is * that this is immune to the configuration mistake (users often fail to set the root URL * correctly, especially when a migration is involved), but the downside * is that unless you are processing a request, this method doesn't work. * * @since 1.263 */ public String getRootUrlFromRequest() { StaplerRequest req = Stapler.getCurrentRequest(); StringBuilder buf = new StringBuilder(); buf.append(req.getScheme() + "://"); buf.append(req.getServerName()); if (req.getServerPort() != 80) { buf.append(':').append(req.getServerPort()); } buf.append(req.getContextPath()).append('/'); return buf.toString(); }
/** * Gets the absolute URL of Hudson top page, such as * "http://localhost/hudson/". * * <p> * Unlike {@link #getRootUrl()}, which uses the manually configured value, * this one uses the current request to reconstruct the URL. The benefit is * that this is immune to the configuration mistake (users often fail to set * the root URL correctly, especially when a migration is involved), but the * downside is that unless you are processing a request, this method doesn't * work. * * @since 1.263 */ public String getRootUrlFromRequest() { StaplerRequest req = Stapler.getCurrentRequest(); StringBuilder buf = new StringBuilder(); buf.append(req.getScheme() + "://"); buf.append(req.getServerName()); if (req.getServerPort() != 80) { buf.append(':').append(req.getServerPort()); } buf.append(req.getContextPath()).append('/'); return buf.toString(); }
if ((req.getScheme().equals("http") && req.getServerPort()!=80) || (req.getScheme().equals("https") && req.getServerPort()!=443)) buf.append(':').append(req.getServerPort()); url = buf.append(url).toString();
if ((req.getScheme().equals("http") && req.getServerPort()!=80) || (req.getScheme().equals("https") && req.getServerPort()!=443)) buf.append(':').append(req.getServerPort()); url = buf.append(url).toString();
String host = getXForwardedHeader(req, "X-Forwarded-Host", req.getServerName()); int index = host.indexOf(':'); int port = req.getServerPort(); if (index == -1) {