public boolean isAjaxRequest() {
        FacesContext context = getFacesContext();
        if (context == null) {
            return false;
        }

        return context.getPartialViewContext().isAjaxRequest();
    }
Shortcut for {@link PartialViewContext#isAjaxRequest()}.

@return <code>true</code> if the current request is a AJAX request.
primefaces/src/main/java/org/primefaces/PrimeFaces.java