List of usage examples for javax.servlet.http HttpServletRequest getServerName
public String getServerName();
From source file:com.amazonaws.cognito.devauthsample.Utilities.java
public static String getEndPoint(HttpServletRequest request) { if (null == request) { return null; } else {/*from w ww . j av a 2s.c o m*/ String endpoint = request.getServerName().toLowerCase(); log.info("Endpoint : " + encode(endpoint)); return endpoint; } }
From source file:com.matel.pg.components.OAuthController.java
/** * * @param request/*from w ww . j av a 2s. c o m*/ * @return */ public static String getProtocolHostnameAndPort(final HttpServletRequest request) { String protocol = request.getProtocol().split("/")[0].toLowerCase(); String hostname = request.getServerName(); int port = request.getServerPort(); StringBuilder result = new StringBuilder(protocol + "://" + hostname); if (port != 80) { result.append(":").append(port); } return result.toString(); }
From source file:be.fedict.eid.pkira.common.security.AbstractAuthenticationHandlerBean.java
public static final String getIssuer(HttpServletRequest request) { StringBuilder url = new StringBuilder(); String scheme = request.getScheme(); String hostName = request.getServerName(); int port = request.getServerPort(); url.append(scheme);/*from w ww .j av a 2s. c om*/ url.append("://"); url.append(hostName); if (port > 0 && ((scheme.equalsIgnoreCase("http") && port != 80) || (scheme.equalsIgnoreCase("https") && port != 443))) { url.append(':'); url.append(port); } return url.toString(); }
From source file:org.jahia.modules.newsletter.action.UnsubscribeAction.java
public static String generateUnsubscribeLink(JCRNodeWrapper newsletterNode, String confirmationKey, HttpServletRequest req) throws RepositoryException { return req.getScheme() + "://" + req.getServerName() + ":" + req.getServerPort() + Jahia.getContextPath() + Render.getRenderServletPath() + "/live/" + newsletterNode.getLanguage() + newsletterNode.getPath() + ".confirm.do?key=" + confirmationKey + "&exec=rem"; }
From source file:com.asual.summer.core.RequestFilter.java
static String getServerName(HttpServletRequest request) { String result = request.getHeader("X-Forwarded-Host"); if (result == null) { result = request.getServerName(); }/* ww w. ja va 2s. co m*/ try { result = java.net.InetAddress.getByName(result).getHostName(); } catch (NoClassDefFoundError e) { } catch (UnknownHostException e) { } return result; }
From source file:com.pamarin.income.util.UrlUtils.java
/** * build pattern//from w w w.ja v a 2s .co m * <ul> * <li>[http|s]://[domainName]:[port]/[contextRoot]</li> * <li>http://pamarin.com/</li> * <li>http://localhost:8080/</li> * <li>http://localhost/pamarin</li> * </ul> * ignore port 80 and 443 * * @param request * @return */ public static String buildHostUrl(HttpServletRequest request) { String contextPath = request.getContextPath(); String protocol = request.getScheme(); String domain = request.getServerName(); String port = request.getServerPort() + ""; port = isReservePort(port) ? "" : (":" + port); return protocol + "://" + domain + port + contextPath; }
From source file:ch.unifr.pai.twice.widgets.mpproxy.server.SimpleHttpUrlConnectionServletFilter.java
/** * @param request/*from w ww .j a va 2s .c o m*/ * @return the path to the current servlet */ public static String getServletPath(HttpServletRequest request) { return request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath(); }
From source file:org.carewebframework.ui.util.RequestUtil.java
/** * Return server name.// ww w . j a va 2s .co m * * @see HttpServletRequest#getServerName() * @return server name */ public static String getServerName() { final HttpServletRequest request = getRequest(); if (request == null) { return null; } return request.getServerName(); }
From source file:com.vmware.demo.HomeController.java
public static String getURLWithContextPath(HttpServletRequest request) { return request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath() + "/"; }
From source file:com.ge.predix.uaa.token.lib.HttpServletRequestUtil.java
/** * Extract zone subdomain from request. If both subdomain and header are specificied, the zone subdomain in * servername overrides the header value. * * @param headerNames/* w w w. jav a2s.c om*/ */ public static String getZoneName(final HttpServletRequest req, final String serviceBaseDomain, final List<String> headerNames) { String zoneName = null; if (!StringUtils.isEmpty(serviceBaseDomain)) { zoneName = getZoneNameFromRequestHostName(req.getServerName(), serviceBaseDomain); } if (StringUtils.isEmpty(zoneName)) { zoneName = findHeader(req, headerNames); } return zoneName; }