Obtains the forwardURI from the request, since Grails uses a forwarding technique for URL mappings. The actual
request URI is held within a request attribute

@param request The request
@return The forward URI
197642
public static String getForwardURI(HttpServletRequest request) {
        String result = (String) request.getAttribute(WebUtils.FORWARD_REQUEST_URI_ATTRIBUTE);
        if (GrailsStringUtils.isBlank(result)) result = request.getRequestURI();
        return result;
    }
945840
protected String getRemoteAddress(ContainerRequestContext request) {
        String ip = null;
        if (realIpHeader != null && realIpHeader.length() != 0) {
            ip = request.getHeaderString(realIpHeader);
        }
        if (StringUtils.isBlank(ip)) {
            ip = request.getHeaderString("x-forwarded-for");
            if (StringUtils.isBlank(ip) || "unknown".equalsIgnoreCase(ip)) {
                ip = request.getHeaderString("Proxy-Client-IP");
            }
            if (StringUtils.isBlank(ip) || "unknown".equalsIgnoreCase(ip)) {
                ip = request.getHeaderString("WL-Proxy-Client-IP");
            }
            if (StringUtils.isBlank(ip) || "unknown".equalsIgnoreCase(ip)) {
                ip = "unknown";
            }
        }
        return ip;
    }
920433
protected String getUsernameParameterFromRequest(final HttpServletRequest request) {
        return request.getParameter(StringUtils.defaultString(configurationContext.getUsernameParameter(), "username"));
    }
279944
public static String getBaseUrl(HttpServletRequest request){
        String baseUrl = null;					
		String host = request.getHeader(WebConstants.HEADER_FORWARDED_HOST);
		String prefix = request.getHeader(WebConstants.HEADER_FORWARDED_PRIFIX);
		if(StringUtils.isAnyBlank(host,prefix)){
			String[] segs = StringUtils.split(request.getRequestURL().toString(),"/");
			baseUrl = segs[0] + "//" + segs[1];
		}else{
			//由于nginx 没有设置  proxy_set_header   X-Forwarded-Proto $scheme;
		    //导致https通过nginx转发后，在api网关获取到的scheme为：http,
			//String proto = request.getHeader(BaseConstants.HEADER_FORWARDED_ORIGN_PROTO);
			//if(proto == null)proto = request.getHeader(BaseConstants.HEADER_FORWARDED_PROTO);
			 String port = request.getHeader(WebConstants.HEADER_FORWARDED_PORT);
			String schame = "443".equals(port) ? "https://" : "http://";
			baseUrl = schame + host + prefix;
		}
		
		if(StringUtils.isNotBlank(request.getContextPath())){
			baseUrl = baseUrl + request.getContextPath();
		}
		
		return baseUrl;
	}
888872
public static String getCurrentUri() {
    HttpServletRequest request =
        ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest();

    StringBuilder uri = new StringBuilder();
    uri.append(request.getAttribute("javax.servlet.forward.request_uri"));

    if (StringUtils.isNotBlank(request.getQueryString())) {
      uri.append("?").append(request.getQueryString());
    }

    return uri.toString();
  }
1138330
protected OAuthToken getOAuthTokenFromRequest(final HttpServletRequest request) {
        val token = getOAuthConfigurationContext().getTicketRegistry().getTicket(getOAuthParameter(request), OAuthToken.class);
        if (token == null || token.isExpired()) {
            LOGGER.error("OAuth token indicated by parameter [{}] has expired or not found: [{}]", getOAuthParameter(request), token);
            if (token != null) {
                getOAuthConfigurationContext().getTicketRegistry().deleteTicket(token.getId());
            }
            return null;
        }
        return token;
    }
754825
protected String getForward(HttpServletRequest req){
		String forward = req.getParameter(PARAM_FORWARD);
		if (forward==null)
			forward = DEFAULT_FORWARD;
		return forward;
	}
1260431
public static String getActionMappingPath( ServletRequest request )
    {
        ActionMapping actionMapping = ( ActionMapping ) request.getAttribute( Globals.MAPPING_KEY );
        return actionMapping != null ? actionMapping.getPath() : null;
    }
1141226
protected UnixUserGroupInformation getUGI(HttpServletRequest request) {
    String ugi = request.getParameter("ugi");
    try {
      return new UnixUserGroupInformation(ugi.split(","));
    }
    catch(Exception e) {
      LOG.warn("Invalid ugi (= " + ugi + ")");
    }
    return JspHelper.webUGI;
  }
309235
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);
		}
		return url.toString();
	}
700522
public static Map<String, String> getRequestHeaders(final HttpServletRequest request) {
        val headers = new LinkedHashMap<String, Object>();
        val headerNames = request.getHeaderNames();
        if (headerNames != null) {
            while (headerNames.hasMoreElements()) {
                val headerName = headerNames.nextElement();
                val headerValue = StringUtils.stripToEmpty(request.getHeader(headerName));
                headers.put(headerName, headerValue);
            }
        }
        return (Map) headers;
    }
1058852
public static boolean isHttpGetRequest(HttpServletRequest request) {
        boolean isSane = isSaneRequest(request);
        boolean isGet = isSane && request.getMethod().equals(HttpMethod.GET.toString());
        return isSane && isGet;
    }
683586
@RequestMapping(value = {"", "{path:^(?:(?!\\bjolokia\\b|auth|css|fonts|img|js|oauth|\\.).)*$}/**"}, produces = MediaType.TEXT_HTML_VALUE)
    public String forwardHawtioRequestToIndexHtml() {
        final String path = endpointPath.resolve("hawtio");
        final UriComponents uriComponents = ServletUriComponentsBuilder.fromPath(path)
            .path("/index.html")
            .build();
        return "forward:" + uriComponents.getPath();
    }
1192352
public URI rewriteURI(Request request) throws URISyntaxException {
        String path = request.path();
        if (!path.startsWith(prefix)) {
            return null;
        }

        StringBuilder uri = new StringBuilder(redirectTo);
        if (redirectTo.endsWith("/")) {
            uri.setLength(uri.length() - 1);
        }
        String rest = path.substring(prefix.length());
        if (!rest.startsWith("/") && !rest.isEmpty()) {
            uri.append("/");
        }
        uri.append(rest);

        // Do we have a query String
        int index = request.uri().indexOf("?");
        String query = null;
        if (index != -1) {
            // Remove the ?
            query = request.uri().substring(index + 1);
        }

        if (!Strings.isNullOrEmpty(query)) {
            uri.append("?").append(query);
        }

        return URI.create(uri.toString()).normalize();
    }
940599
public static Tag uri(HttpRequest request) {
		return Tag.of("uri", ensureLeadingSlash(stripUri(request.getURI().toString())));
	}
649535
public static GeoLocationRequest getHttpServletRequestGeoLocation(final HttpServletRequest request) {
        val loc = new GeoLocationRequest();
        if (request != null) {
            val geoLocationParam = request.getParameter("geolocation");
            if (StringUtils.isNotBlank(geoLocationParam)) {
                val geoLocation = Splitter.on(",").splitToList(geoLocationParam);
                loc.setLatitude(geoLocation.get(GEO_LOC_LAT_INDEX));
                loc.setLongitude(geoLocation.get(GEO_LOC_LONG_INDEX));
                loc.setAccuracy(geoLocation.get(GEO_LOC_ACCURACY_INDEX));
                loc.setTimestamp(geoLocation.get(GEO_LOC_TIME_INDEX));
            }
        }
        return loc;
    }
890551
public static void storeRequestURI(final HttpServletRequest request) {
		request.getSession(true).setAttribute(STORE_URI_KEY, request.getRequestURI());
	}