GAE/J: unable to register a custom ELResolver

Posted by dfa on Stack Overflow See other posts from Stack Overflow or by dfa
Published on 2010-03-31T08:46:02Z Indexed on 2010/03/31 9:33 UTC
Read the original article Hit count: 330

Filed under:
|
|

I need to register a custom ELResolver for a Google App Engine project.

Since it must be registered before any request is received, as specified by the Javadoc:

It is illegal to register an ELResolver after the application has received any request from the client. If an attempt is made to register an ELResolver after that time, an IllegalStateException is thrown.

I'm using a ServletContextListener:

public class RegisterCustomELResolver implements ServletContextListener { 

    @Override 
    public void contextInitialized(ServletContextEvent sce) { 
        ServletContext context = sce.getServletContext(); 
        JspApplicationContext jspContext = 
            JspFactory.getDefaultFactory().getJspApplicationContext(context); 
        jspContext.addELResolver(new MyELResolver()); 
    } 

    ... 
}

The problem is that JspFactory.getDefaultFactory() returns always null. I've alreay filled a bug report. Any idea for a workaround?

© Stack Overflow or respective owner

Related posts about java

Related posts about servlet