List of usage examples for javax.servlet.http HttpServletRequest getServerPort
public int getServerPort();
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:ch.unifr.pai.twice.widgets.mpproxy.server.SimpleHttpUrlConnectionServletFilter.java
/** * @param request//ww w . ja v a 2 s . 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: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);/* www .j av a2 s . c o m*/ 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.eclipse.orion.server.openid.core.OpenIdHelper.java
private static StringBuffer getRequestServer(HttpServletRequest req) { StringBuffer url = new StringBuffer(); String scheme = req.getScheme(); int port = req.getServerPort(); url.append(scheme);/*from w w w. j a v a2 s . c o m*/ url.append("://"); //$NON-NLS-1$ url.append(req.getServerName()); if ((scheme.equals("http") && port != 80) //$NON-NLS-1$ || (scheme.equals("https") && port != 443)) { //$NON-NLS-1$ url.append(':'); url.append(req.getServerPort()); } return url; }
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.pamarin.income.util.UrlUtils.java
/** * build pattern/*from w w w . j a va 2s . com*/ * <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:org.benjp.listener.ServerBootstrap.java
public static String getServerBase() { String serverBase = PropertyManager.getProperty(PropertyManager.PROPERTY_CHAT_SERVER_BASE); if ("".equals(serverBase)) { HttpServletRequest request = Util.getPortalRequestContext().getRequest(); String scheme = request.getScheme(); String serverName = request.getServerName(); int serverPort = request.getServerPort(); serverBase = scheme + "://" + serverName; if (serverPort != 80) serverBase += ":" + serverPort; }/*from www . j av a 2s .c o m*/ return serverBase; }
From source file:com.rantop.web.util.web.ServletUtils.java
/** * Convenience method to get the application's URL based on request * variables.//from w w w . j av a 2 s.co m */ public static String getAppURL(HttpServletRequest request) { StringBuffer url = new StringBuffer(); int port = request.getServerPort(); if (port < 0) { port = 80; // Work around java.net.URL bug } String scheme = request.getScheme(); url.append(scheme); url.append("://"); url.append(request.getServerName()); if ((scheme.equals("http") && (port != 80)) || (scheme.equals("https") && (port != 443))) { url.append(':'); url.append(port); } url.append(request.getContextPath()); return url.toString(); }
From source file:be.fedict.eid.idp.sp.ConfigServlet.java
public static String getIdpBaseLocation(HttpServletRequest request) { String baseLocation = idpBaseLocation; if (null == baseLocation || baseLocation.trim().isEmpty()) { baseLocation = "https://" + request.getServerName() + ":" + request.getServerPort() + "/eid-idp/"; }/*from ww w. j a v a2 s . co m*/ if (!baseLocation.endsWith("/")) { baseLocation += '/'; } idpBaseLocation = baseLocation; return baseLocation; }
From source file:com.vmware.photon.controller.api.common.Responses.java
private static URI getBaseUri(HttpServletRequest request) throws IllegalArgumentException { String requestBaseUri = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort(); return UriBuilder.fromUri(requestBaseUri).build(); }