javax.el.ELContextListener Java Examples

The following examples show how to use javax.el.ELContextListener. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JspApplicationContextImpl.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
@Override
public void addELContextListener(ELContextListener listener) {
    if (listener == null) {
        throw new IllegalArgumentException("ELContextListener was null");
    }
    this.contextListeners.add(listener);
}
 
Example #2
Source File: ConfigManager.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * Publishes a {@link javax.faces.event.PostConstructApplicationEvent} event for the current
 * {@link Application} instance.
 */
void publishPostConfigEvent() {

    FacesContext ctx = FacesContext.getCurrentInstance();
    Application app = ctx.getApplication();
    if (null == ((InitFacesContext)ctx).getELContext()) {
        ELContext elContext = new ELContextImpl(app.getELResolver());
        elContext.putContext(FacesContext.class, ctx);
        UIViewRoot root = ctx.getViewRoot();
        if (null != root) {
            elContext.setLocale(root.getLocale());
        }
        ELContextListener[] listeners = app.getELContextListeners();
        if (listeners.length > 0) {
            ELContextEvent event = new ELContextEvent(elContext);
            for (ELContextListener listener: listeners) {
                listener.contextCreated(event);
            }
        }
        ((InitFacesContext)ctx).setELContext(elContext);
    }

    app.publishEvent(ctx,
                     PostConstructApplicationEvent.class,
                     Application.class,
                     app);

}
 
Example #3
Source File: JspApplicationContextImpl.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
@Override
public void addELContextListener(ELContextListener listener) {
    if (listener == null) {
        throw new IllegalArgumentException("ELConextListener was null");
    }
    this.contextListeners.add(listener);
}
 
Example #4
Source File: JspApplicationContextImpl.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
@Override
public void addELContextListener(ELContextListener listener) {
    if (listener == null) {
        throw new IllegalArgumentException("ELConextListener was null");
    }
    this.contextListeners.add(listener);
}
 
Example #5
Source File: JspApplicationContextImpl.java    From packagedrone with Eclipse Public License 1.0 5 votes vote down vote up
protected ELContext createELContext(ELResolver resolver) {

        ELContext elContext = new ELContextImpl(resolver);

        // Notify the listeners
        Iterator<ELContextListener> iter = listeners.iterator();
        while (iter.hasNext()) {
            ELContextListener elcl = iter.next();
            elcl.contextCreated(new ELContextEvent(elContext));
        }
        return elContext;
    }
 
Example #6
Source File: ELSampleBean.java    From tutorials with MIT License 5 votes vote down vote up
@PostConstruct
public void init() {
    pageCounter = randomIntGen.nextInt();
    FacesContext.getCurrentInstance()
        .getApplication()
        .addELContextListener(new ELContextListener() {
            @Override
            public void contextCreated(ELContextEvent evt) {
                evt.getELContext()
                    .getImportHandler()
                    .importClass("com.baeldung.springintegration.controllers.ELSampleBean");
            }
        });
}
 
Example #7
Source File: JspApplicationContextImpl.java    From packagedrone with Eclipse Public License 1.0 4 votes vote down vote up
public void addELContextListener(ELContextListener listener) {
    listeners.add(listener);
}
 
Example #8
Source File: JspApplicationContext.java    From Tomcat8-Source-Read with MIT License 2 votes vote down vote up
/**
 * Registers an <code>ELContextListener</code> that will be notified
 * whenever a new <code>ELContext</code> is created.
 * <p>
 * At the very least, any <code>ELContext</code> instantiated will have
 * reference to the <code>JspContext</code> under
 * <code>JspContext.class</code>.
 *
 * @param listener The listener to add
 */
public void addELContextListener(ELContextListener listener);
 
Example #9
Source File: JspApplicationContext.java    From Tomcat7.0.67 with Apache License 2.0 2 votes vote down vote up
/**
 * Registers an <code>ELContextListener</code> that will be notified
 * whenever a new <code>ELContext</code> is created.
 * <p>
 * At the very least, any <code>ELContext</code> instantiated will have
 * reference to the <code>JspContext</code> under
 * <code>JspContext.class</code>.
 * 
 * @param listener The listener to add
 */
public void addELContextListener(ELContextListener listener);
 
Example #10
Source File: JspApplicationContext.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Registers a <code>ELContextListener</code>s so that context objects
 * can be added whenever a new <code>ELContext</code> is created.
 *
 * <p>At a minimum, the <code>ELContext</code> objects created will
 * contain a reference to the <code>JspContext</code> for this request,
 * which is added by the JSP container.
 * This is sufficient for all the
 * default <code>ELResolver</code>s listed in {@link #addELResolver}.
 * Note that <code>JspContext.class</code> is used as the key to ELContext.putContext()
 * for the <code>JspContext</code> object reference.</p>
 *
 * <p>This method is generally used by frameworks and applications that
 * register their own <code>ELResolver</code> that needs context other
 * than <code>JspContext</code>. The listener will typically add the
 * necessary context to the <code>ELContext</code> provided in the
 * event object. Registering a listener that adds context allows the
 * <code>ELResolver</code>s in the stack to access the context they
 * need when they do a resolution.</p>
 *
 * @param listener The listener to be notified when a new
 *     <code>ELContext</code> is created.
 */
public void addELContextListener(ELContextListener listener);
 
Example #11
Source File: JspApplicationContext.java    From tomcatsrc with Apache License 2.0 2 votes vote down vote up
/**
 * Registers an <code>ELContextListener</code> that will be notified
 * whenever a new <code>ELContext</code> is created.
 * <p>
 * At the very least, any <code>ELContext</code> instantiated will have
 * reference to the <code>JspContext</code> under
 * <code>JspContext.class</code>.
 * 
 * @param listener The listener to add
 */
public void addELContextListener(ELContextListener listener);