List of usage examples for javax.servlet.http HttpServletRequest getServerName
public String getServerName();
From source file:com.exxonmobile.ace.hybris.storefront.controllers.pages.AbstractPageController.java
@ModelAttribute("jirafeApiUrl") public String getJirafeApiUrl(final HttpServletRequest request) { return getHostConfigService().getProperty(ThirdPartyConstants.Jirafe.API_URL, request.getServerName()); }
From source file:com.exxonmobile.ace.hybris.storefront.controllers.pages.AbstractPageController.java
@ModelAttribute("jirafeVersion") public String getJirafeVersion(final HttpServletRequest request) { return getHostConfigService().getProperty(ThirdPartyConstants.Jirafe.VERSION, request.getServerName()); }
From source file:com.exxonmobile.ace.hybris.storefront.controllers.pages.AbstractPageController.java
@ModelAttribute("jirafeDataUrl") public String getJirafeDataUrl(final HttpServletRequest request) { return getHostConfigService().getProperty(ThirdPartyConstants.Jirafe.DATA_URL, request.getServerName()); }
From source file:com.seajas.search.utilities.tags.URLTag.java
/** * Rewrite a URL.//from ww w . j a va 2 s. co m * * @param context * @param request * @param url * @param fullUrl * @return String */ public static String rewriteURL(final ServletContext context, final HttpServletRequest request, final String url, final Boolean fullUrl) { String rewrittenURL = url; String contextName = context.getContextPath(); if (contextName == null) contextName = System.getProperty(SYSTEM_DEFAULT_CONTEXT); if (contextName.startsWith("/")) contextName = contextName.substring(1); if (Boolean.getBoolean(SYSTEM_REWRITTEN_URLS)) { if (rewrittenURL.startsWith(contextName)) rewrittenURL = rewrittenURL.substring(contextName.length()); if (rewrittenURL.startsWith("/" + contextName)) rewrittenURL = rewrittenURL.substring(contextName.length() + 1); // Make sure the index link redirects to '/' if (rewrittenURL.equals("/index.html")) rewrittenURL = "/"; } else if (!rewrittenURL.startsWith("/" + contextName)) rewrittenURL = "/" + contextName + rewrittenURL; if (fullUrl) { String forwardedFor = request.getHeader("X-Forwarded-Host"); rewrittenURL = request.getScheme() + "://" + (StringUtils.isEmpty(forwardedFor) ? request.getServerName() + (request.getServerPort() != 80 ? ":" + request.getServerPort() : "") : forwardedFor) + (rewrittenURL.startsWith("/") ? rewrittenURL : "/" + rewrittenURL); } return rewrittenURL; }
From source file:com.exxonmobile.ace.hybris.storefront.controllers.pages.AbstractPageController.java
@ModelAttribute("jirafeApiToken") public String getJirafeApitoken(final HttpServletRequest request) { return getHostConfigService().getProperty(ThirdPartyConstants.Jirafe.API_TOKEN, request.getServerName()); }
From source file:de.hybris.platform.chineseprofile.controllers.pages.ChineseLoginPageController.java
@Override protected void storeReferer(final String referer, final HttpServletRequest request, final HttpServletResponse response) { if (StringUtils.isNotBlank(referer) && !StringUtils.endsWith(referer, "/login") && !StringUtils.endsWith(referer, MOBILE_REBIND_URL) && !StringUtils.endsWith(referer, MOBILE_BIND_URL) && StringUtils.contains(referer, request.getServerName())) { httpSessionRequestCache.saveRequest(request, response); }/*from w ww. j av a 2 s. c om*/ }
From source file:de.ifgi.lodum.sparqlfly.SparqlFly.java
/** * Returns the base URL of the server /*from ww w . j ava 2s .com*/ * * @param request * @return */ private String getRequestBaseURL(HttpServletRequest request) { return ("http://" + request.getServerName() + ":" + request.getServerPort()); }
From source file:com.biblio.web.rest.UserResource.java
/** * POST /account/reset_password/init : Send an e-mail to reset the password * of the user//ww w . ja v a2 s . co m * * @param mail the mail of the user * @param request the HTTP request * @return the ResponseEntity with status 200 (OK) if the e-mail was sent, * or status 400 (Bad Request) if the e-mail address is not registered */ @RequestMapping(value = "/account/reset_password/init", method = RequestMethod.POST, produces = MediaType.TEXT_PLAIN_VALUE) public ResponseEntity<?> requestPasswordReset(@RequestBody String mail, HttpServletRequest request) { return userService.requestPasswordReset(mail).map(user -> { String baseUrl = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath(); // mailService.sendPasswordResetMail(user, baseUrl); return new ResponseEntity<>("e-mail was sent", HttpStatus.OK); }).orElse(new ResponseEntity<>("e-mail address not registered", HttpStatus.BAD_REQUEST)); }
From source file:com.oscgc.security.saml.idp.web.contoller.MetadataController.java
protected String getEntityId(HttpServletRequest request) { log.debug("Server name used as entity id {}", request.getServerName()); return request.getServerName(); }
From source file:com.jredrain.session.HttpSessionFilter.java
private Cookie generateCookie(HttpServletRequest request, HttpServletResponse response) { Cookie sessionIdCookie;/*from www . j a va 2 s . c o m*/ String sid = null; if (StringUtils.isBlank(sid)) { sid = CommonUtils.uuid(); } sessionIdCookie = new Cookie(sessionIdCookieName, sid); String domain = request.getServerName(); if (domain != null) { sessionIdCookie.setDomain(domain); } sessionIdCookie.setPath("/"); response.addCookie(sessionIdCookie); return sessionIdCookie; }