miercuri, 29 aprilie 2015

[OmniFaces utilities (2.0)] Check if the current request is a PrimeFaces dynamic resource request


[OmniFaces utilities] The isPrimeFacesDynamicResourceRequest() method returns true if the current request is a PrimeFaces dynamic resource request.

Method:
Usage:

boolean is = Hacks.isPrimeFacesDynamicResourceRequest(FacesContext.getCurrentInstance());
if(is){
   // is
} else {
   //is not
}

For example, PrimeFaces generates dynamic resource requests when we try to load images from StreamedContent via <p:graphicImage>. Such request may look like in figure below:

If you write a custom resource handler, it will be useful to distinguish such cases.

Niciun comentariu:

Trimiteți un comentariu