public String encodeRedirectUrl(String s) { return encodeRedirectURL(s); }
public String encodeUrl(String s) { return encodeURL(s); }
/** * Encode the session identifier associated with this response * into the specified redirect URL, if necessary. * * @param url URL to be encoded */ public String encodeRedirectURL(String url) { if (isEncodeable(toAbsolute(url))) { return toEncoded(url, request.getSession().getId()); } else { return url; } }
if (leadingSlash || !hasScheme(location)) { relativePath = relativePath.substring(0, pos); String encodedURI = URLEncoder.encode(relativePath, getCharacterEncoding()); buf.append(encodedURI).append('/');
/** * Returns {@code true} if the URI string has a {@code scheme} component, {@code false} otherwise. * * @param uri the URI string to check for a scheme component * @return {@code true} if the URI string has a {@code scheme} component, {@code false} otherwise. */ private boolean hasScheme(String uri) { int len = uri.length(); for (int i = 0; i < len; i++) { char c = uri.charAt(i); if (c == ':') { return i > 0; } else if (!isSchemeChar(c)) { return false; } } return false; }
/** * Returns a new {@link ShiroHttpServletResponse} instance, wrapping the {@code orig} argument, in order to provide * correct URL rewriting behavior required by the Servlet Specification when using Shiro-based sessions (and not * Servlet Container HTTP-based sessions). * * @param orig the original {@code HttpServletResponse} instance provided by the Servlet Container. * @param request the {@code ShiroHttpServletRequest} instance wrapping the original request. * @return the wrapped ServletResponse instance to use during {@link FilterChain} execution. * @since 1.0 */ protected ServletResponse wrapServletResponse(HttpServletResponse orig, ShiroHttpServletRequest request) { return new ShiroHttpServletResponse(orig, getServletContext(), request); }
return (false); String contextPath = getRequest().getContextPath(); if (contextPath != null) { String file = url.getFile();
return (false); return doIsEncodeable(hreq, session, location);
/** * Encode the session identifier associated with this response * into the specified URL, if necessary. * * @param url URL to be encoded */ public String encodeURL(String url) { String absolute = toAbsolute(url); if (isEncodeable(absolute)) { // W3c spec clearly said if (url.equalsIgnoreCase("")) { url = absolute; } return toEncoded(url, request.getSession().getId()); } else { return url; } }