DwrGuiceServlet.java 文件源码

java
阅读 35 收藏 0 点赞 0 评论 0

项目:parabuild-ci 作者:
/**
 * Copies DWR configuration values from the Guice bindings into 
 * {@code servletConfig} to make these values accessible to the 
 * standard DWR servlet configuration machinery.
 */
@Override public void init(ServletConfig servletConfig) throws ServletException
{
    // Save this for later use by destroy.
    this.servletContext = servletConfig.getServletContext();

    // Set the current context thread-locally so our internal classes can
    // look up the Injector and use it in turn to look up further objects.
    pushServletContext(this.servletContext);
    try
    {      
        // Since ServletConfig is immutable, we use a modifiable 
        // decoration of the real servlet configuration and pass 
        // that to the init method of the superclass.
        ModifiableServletConfig config = new ModifiableServletConfig(servletConfig);

        // Apply settings configured at bind-time.
        setInitParameters(config);

        // Use our internal manager classes to replace and delegate to
        // any user-specified or default implementations, after adding
        // additional creators and converters registered at bind-time.
        configureDelegatedTypes(config);

        // Normal DwrServlet initialization happens here using the
        // modified ServletConfig instead of the one we were passed.
        super.init(config);

        // Objects with (non-global) application scope are initialized
        // eagerly.
        initApplicationScoped();            
    }
    finally
    {
        // Clean up the ThreadLocal we just used.
        popServletContext();
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号