private String getRedirectURL(HttpServletRequest request, String loginPage,
            String optionalParams)
    {
        StringBuilder buf = new StringBuilder();
        try {
            buf.append(request.getRequestURI());
            String qs = request.getQueryString();
            if (qs != null) {
                buf.append('?').append(qs);
            }
        }
        catch (Exception e) {
            Log.error(e.getMessage(), e);
        }
        try {
            return loginPage + "?url=" + URLEncoder.encode(buf.toString(), StandardCharsets.ISO_8859_1)
                    + (optionalParams != null ? "&"+optionalParams : "");
        }
        catch (Exception e) {
            Log.error(e.getMessage(), e);
            return null;
        }
    }
Returns true if a URL passes an exclude rule.

@param url the URL to test.
@param exclude the exclude rule.
@return true if the URL passes the exclude test.
xmppserver/src/main/java/org/jivesoftware/admin/AuthCheckFilter.java