@Override
    public void init(ServletConfig config) throws ServletException {
        super.init(config);

        String memcacheClass = config.getInitParameter("memcache.provider.class");
        if (memcacheClass == null) {
            memCache = new LocalMemCache();
            log("Initialized memory cache provider: "+memCache);
        } else {
            try {
                memCache = (MemCacheProvider) Class.forName(memcacheClass)
                        .newInstance();
            } catch (Exception ex) {
                throw new ServletException("Could not initialize memory cache provider. ", ex);
            }
            log("Using "+memCache.getClass().getName()+" memory cache provider.");
        }

        
        controllerPkg = config.getInitParameter("controller.package.name");
        if (controllerPkg != null) {
            controllerPkg = controllerPkg.trim();
        }
        String extraConfig = config.getInitParameter("load.extra.config");
        if (extraConfig != null) {
            InputStream stream = getServletContext().getResourceAsStream(extraConfig);
            Properties prop = new Properties();
            try {
                prop.load(stream);
                getServletContext().setAttribute(EXTRA_CONFIG, prop);
            } catch (IOException ex) {
                throw new ServletException("Could not load extra config. ", ex);
            }
            log("Loaded extra config from "+extraConfig);
        }

        String viewProviderClass = config.getInitParameter("view.provider.class");
        if (viewProviderClass == null) {
            viewProviderClass
                    = getClass().getPackage().getName() + ".StringViewProvider";
        }
        try {
            viewProvider = (ViewProvider) Class.forName(viewProviderClass).newInstance();
            viewProvider.init(getServletContext(), config);
        } catch (Exception ex) {
            throw new ServletException("Could not initialize ViewProvider. ", ex);
        }
        log("Using "+viewProvider.getClass().getName()+" view provider.");
        log("+++++++++++++++++++++ Initialization complete +++++++++++++++++++++");
    }