[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[equinox-dev] TCCL and Servlet bridge

Hi Devs,

In the service method of ServletBridge class, the line of codes related TCCL setting is very peculiar .

=====================
ClassLoader original = Thread.currentThread().getContextClassLoader();
        HttpServlet servletReference = acquireDelegateReference();
        if (servletReference == null) {
            resp.sendError(HttpServletResponse.SC_NOT_FOUND, "BridgeServlet: " + req.getRequestURI()); //$NON-NLS-1$
            return;
        }
        try {
            Thread.currentThread().setContextClassLoader(framework.getFrameworkContextClassLoader());
            servletReference.service(req, resp);
        } finally {
            releaseDelegateReference();
            Thread.currentThread().setContextClassLoader(original);
        }
=====================

Why would it need to do so. ServletBridge itself is part of fragment host that extends the framework classpath.

I would really appreciate if someone could elaborate the semantics behind here.

Thank you!

Saminda