I had a small problem using Spring and DelegatingFilterProxy work together
with MMBase, where
it was the case of 'who starts who first'. In order to solve this we had to
make a small bootstrap class
called MMBaseServletContextListener which starts mmbase instead of a
servlet.

To make this work add a listener in web.xml:

    <listener>
        <listener-class>nl.vpro.mmbase.util.MMBaseServletContextListener
</listener-class>
    </listener>

The bootstrap-code MMBaseServletContextListener.java:

package nl.vpro.mmbase.util;
import javax.servlet.ServletContextEvent;

public class MMBaseServletContextListener implements ServletContextListener
{
    private static final Logger log = Logger.getLogger(
MMBaseServletContextListener.class);

    public void contextDestroyed(ServletContextEvent arg0) {
    }

    public void contextInitialized(ServletContextEvent arg0) {
        try {
            MMBaseContext.init(arg0.getServletContext());
            MMBaseContext.initHtmlRoot();
        } catch(ServletException e) {
            log.error(e);
        }
    }
}

After this mmbase is started before the filter-code kicks in, thus enabeling
access to mmbase
from a filter.

gr,
 marcel
_______________________________________________
Developers mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/developers

Reply via email to