@Nullable
    public static String removeMatrixVariables(String path) {
        int semicolonIndex = path.indexOf(';');
        if (semicolonIndex < 0) {
            return path;
        }
        if (semicolonIndex == 0 || path.charAt(semicolonIndex - 1) == '/') {
            // Invalid matrix variable e.g. /;a=b/foo
            return null;
        }
        int subStringStartIndex = 0;
        try (TemporaryThreadLocals threadLocals = TemporaryThreadLocals.acquire()) {
            final StringBuilder sb = threadLocals.stringBuilder();
            for (;;) {
                sb.append(path, subStringStartIndex, semicolonIndex);
                final int slashIndex = path.indexOf('/', semicolonIndex + 1);
                if (slashIndex < 0) {
                    return sb.toString();
                }
                subStringStartIndex = slashIndex;
                semicolonIndex = path.indexOf(';', subStringStartIndex + 1);
                if (semicolonIndex < 0) {
                    sb.append(path, subStringStartIndex, path.length());
                    return sb.toString();
                }
                if (path.charAt(semicolonIndex - 1) == '/') {
                    // Invalid matrix variable e.g. /prefix/;a=b/foo
                    return null;
                }
            }
        }
    }
Marks this {@link RequestTarget} as stored in {@link RequestTargetCache} so that it doesn't
try to store again.
core/src/main/java/com/linecorp/armeria/internal/common/DefaultRequestTarget.java