@Override protected void destory(int arg) { servletFilterBridgeServiceRegistration.unregister(); // 停止时,保存相关运行时状态到ServletContext中。 WebContext.getServletContext() .setAttribute(QUICKWEBFRAMEWORK_STATE_FILTERCONFIG, getFilterConfig()); }
@Override protected void init(int arg) { BundleContext bundleContext = Activator.getContext(); // 启动时,从ServletContext中读取相关运行时状态 Object filterConfigObject = WebContext.getServletContext().getAttribute(QUICKWEBFRAMEWORK_STATE_FILTERCONFIG); if (filterConfigObject != null) setFilterConfig((FilterConfig) filterConfigObject); // 注册过滤器桥接对象 servletFilterBridgeServiceRegistration = bundleContext.registerService( ServletFilterBridge.class.getName(), new ServletFilterBridge(), null); }