public String getRequestUrl() {
        StringBuilder requestUrl = new StringBuilder(getRequestURI());

        // remove duplicate leading slashes
        while (requestUrl.length() > 1 && requestUrl.charAt(1) == '/') {
            requestUrl.deleteCharAt(0);
        }

        if (getQueryString() != null) {
            requestUrl.append("?").append(getQueryString());
        }
        return requestUrl.toString();
    }
Constructs a new instance from the given HTTP request.

@param request the current request to save.
web/src/main/java/org/apache/shiro/web/util/SavedRequest.java