All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.primefaces.context.PrimeFacesContext Maven / Gradle / Ivy

There is a newer version: 14.0.0-RC3
Show newest version
package org.primefaces.context;

import javax.faces.context.FacesContext;
import javax.faces.context.FacesContextWrapper;

/**
 * Custom {@link FacesContextWrapper} to init and release our {@link RequestContext}.
 */
public class PrimeFacesContext extends FacesContextWrapper {

	private final FacesContext wrapped;
	
	public PrimeFacesContext(FacesContext wrapped) {
		this.wrapped = wrapped;
		
		RequestContext.setCurrentInstance(new DefaultRequestContext(wrapped));
	}

	@Override
	public FacesContext getWrapped() {
		return wrapped;
	}
	
	@Override
	public void release() {
		RequestContext.getCurrentInstance().release();

		wrapped.release();
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy