Class PrimeFacesResourceProcessor

java.lang.Object
org.primefaces.extensions.application.PrimeFacesResourceProcessor
All Implemented Interfaces:
Serializable, EventListener, javax.faces.event.PhaseListener

public class PrimeFacesResourceProcessor extends Object implements javax.faces.event.PhaseListener
Creates a custom PhaseListener for RENDER_RESPONSE phase which will during beforePhase() dynamically add those PrimeFaces resources via UIViewRoot#addComponentResource(). This will run far before those @ResourceDependency annotations are processed. This satisfies PrimeFaces' intent of having those hardcoded resources to be rendered before of the dependencies of their components.

Register it as below in faces-config.xml:

   <lifecycle>
      <phase-listener>org.primefaces.extensions.application.PrimeFacesResourceProcessor</phase-listener>
   </lifecycle>
 
Since:
10.0.0
See Also:
  • Constructor Details

    • PrimeFacesResourceProcessor

      public PrimeFacesResourceProcessor()
  • Method Details

    • getPhaseId

      public javax.faces.event.PhaseId getPhaseId()
      Specified by:
      getPhaseId in interface javax.faces.event.PhaseListener
    • afterPhase

      public void afterPhase(javax.faces.event.PhaseEvent event)
      Specified by:
      afterPhase in interface javax.faces.event.PhaseListener
    • beforePhase

      public void beforePhase(javax.faces.event.PhaseEvent event)
      Specified by:
      beforePhase in interface javax.faces.event.PhaseListener
    • encodeValidationResources

      protected void encodeValidationResources(javax.faces.context.FacesContext context, org.primefaces.config.PrimeConfiguration configuration)