protected boolean isForward(FacesContext context) {
        Object request = context.getExternalContext().getRequest();
        if (request instanceof HttpServletRequest) {
            return ((HttpServletRequest) request).getAttribute("jakarta.servlet.forward.request_uri") != null;
        }
        return false;
    }
Checks if the current request is a forward.

@param context The FacesContext
@return true if request is forwarded, false otherwise
primefaces/src/main/java/org/primefaces/csp/CspState.java