@Nullable
    public static String mappedPath(ServiceRequestContext ctx) {
        final RequestTarget requestTarget = ctx.routingContext().requestTarget();
        final String pathWithMatrixVariables = requestTarget.maybePathWithMatrixVariables();
        if (pathWithMatrixVariables.equals(ctx.path())) {
            return ctx.mappedPath();
        }
        // The request path contains matrix variables. e.g. "/foo/bar/users;name=alice"

        final String prefix = ctx.path().substring(0, ctx.path().length() - ctx.mappedPath().length());
        // The prefix is now `/foo/bar`
        if (!pathWithMatrixVariables.startsWith(prefix)) {
            // The request path has matrix variables in the wrong place. e.g. "/foo;name=alice/bar/users"
            return null;
        }
        final String mappedPath = pathWithMatrixVariables.substring(prefix.length());
        if (mappedPath.charAt(0) != '/') {
            // Again, the request path has matrix variables in the wrong place. e.g. "/foo/bar;/users"
            return null;
        }
        return mappedPath;
    }
Returns the path with its prefix removed. Unlike {@link ServiceRequestContext#mappedPath()}, this method
returns the path with matrix variables if the mapped path contains matrix variables.
This returns {@code null} if the path has matrix variables in the prefix.
core/src/main/java/com/linecorp/armeria/internal/common/util/MappedPathUtil.java