web/src/main/java/org/springframework/security/web/firewall/RequestWrapper.java
private String strip(String path) {
		if (path == null) {
			return null;
		}

		int scIndex = path.indexOf(';');

		if (scIndex < 0) {
			int doubleSlashIndex = path.indexOf("//");
			if (doubleSlashIndex < 0) {
				// Most likely case, no parameters in any segment and no '//', so no
				// stripping required
				return path;
			}
		}

		StringTokenizer st = new StringTokenizer(path, "/");
		StringBuilder stripped = new StringBuilder(path.length());

		if (path.charAt(0) == '/') {
			stripped.append('/');
		}

		while (st.hasMoreTokens()) {
			String segment = st.nextToken();
			scIndex = segment.indexOf(';');

			if (scIndex >= 0) {
				segment = segment.substring(0, scIndex);
			}
			stripped.append(segment).append('/');
		}

		// Remove the trailing slash if the original path didn't have one
		if (path.charAt(path.length() - 1) != '/') {
			stripped.deleteCharAt(stripped.length() - 1);
		}

		return stripped.toString();
	}
private String strip(String path) {
		if (path == null) {
			return null;
		}

		int scIndex = path.indexOf(';');

		if (scIndex < 0) {
			int doubleSlashIndex = path.indexOf("//");
			if (doubleSlashIndex < 0) {
				// Most likely case, no parameters in any segment and no '//', so no
				// stripping required
				return path;
			}
		}

		StringTokenizer st = new StringTokenizer(path, "/");
		StringBuilder stripped = new StringBuilder(path.length());

		if (path.charAt(0) == '/') {
			stripped.append('/');
		}

		while (st.hasMoreTokens()) {
			String segment = st.nextToken();
			scIndex = segment.indexOf(';');

			if (scIndex >= 0) {
				segment = segment.substring(0, scIndex);
			}
			stripped.append(segment).append('/');
		}

		// Remove the trailing slash if the original path didn't have one
		if (path.charAt(path.length() - 1) != '/') {
			stripped.deleteCharAt(stripped.length() - 1);
		}

		return stripped.toString();
	}
private String strip ( String path ) { if ( path == null ) { return null ; } int scIndex = path . indexOf ( ' ' ) ; if ( scIndex < 0 ) { int doubleSlashIndex = path . indexOf ( "//" ) ; if ( doubleSlashIndex < 0 ) { // Most likely case, no parameters in any segment and no '//', so no // stripping required return path ; } } StringTokenizer st = new StringTokenizer ( path , "/" ) ; StringBuilder stripped = new StringBuilder ( path . length ( ) ) ; if ( path . charAt ( 0 ) == ' ' ) { stripped . append ( ' ' ) ; } while ( st . hasMoreTokens ( ) ) { String segment = st . nextToken ( ) ; scIndex = segment . indexOf ( ' ' ) ; if ( scIndex >= 0 ) { segment = segment . substring ( 0 , scIndex ) ; } stripped . append ( segment ) . append ( ' ' ) ; } // Remove the trailing slash if the original path didn't have one if ( path . charAt ( path . length ( ) - 1 ) != ' ' ) { stripped . deleteCharAt ( stripped . length ( ) - 1 ) ; } return stripped . toString ( ) ; }
Removes path parameters from each path segment in the supplied path and truncates
sequences of multiple '/' characters to a single '/'.

@param path either the {@code servletPath} and {@code pathInfo} from the original
request

@return the supplied value, with path parameters removed and sequences of multiple
'/' characters truncated, or null if the supplied path was null.
Removes path parameters from each path segment in the supplied path and truncates sequences of multiple / characters to a single / .