public static String getRelativeURI( HttpServletRequest request, String uri, PageFlowController relativeTo )
    {
        String contextPath = request.getContextPath();
        if ( relativeTo != null ) contextPath += relativeTo.getModulePath();
        int overlap = uri.indexOf( contextPath + '/' );
        if ( overlap == -1 ) return null;
        return uri.substring( overlap + contextPath.length() );
    }
public static String getRelativeURI ( HttpServletRequest request , String uri , PageFlowController relativeTo ) { String contextPath = request . getContextPath ( ) ; if ( relativeTo != null ) contextPath += relativeTo . getModulePath ( ) ; int overlap = uri . indexOf ( contextPath + '/' ) ; if ( overlap == - 1 ) return null ; return uri . substring ( overlap + contextPath . length ( ) ) ; }
Get a URI relative to the URI of the given PageFlowController.

@param request the current HttpServletRequest.
@param uri the URI which should be made relative.
@param relativeTo a PageFlowController to which the returned URI should be relative, or
<code>null</code> if the returned URI should be relative to the webapp root.