package com.logzc.webzic.demo.servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Created by lishuang on 2016/7/7.
 */
@WebServlet("/classloader")
public class ClassLoaderServlet extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse response) throws ServletException, IOException {
        response.setContentType("text/html");
        PrintWriter out = response.getWriter();
        ClassLoader loader = this.getClass().getClassLoader();
        while(loader != null) {
            out.write(loader.getClass().getName()+"<br/>");
            loader = loader.getParent();
        }
        out.write(String.valueOf(loader));
        out.flush();
        out.close();
    }

}

@@ -993,16 +993,361 @@
 oader));
+%0A%0A        out.write(%22%3Cbr/%3E-------------%3Cbr/%3E%22);%0A%0A        loader = Thread.currentThread().getContextClassLoader();%0A        while(loader != null) %7B%0A            out.write(loader.getClass().getName()+%22%3Cbr/%3E%22);%0A            loader = loader.getParent();%0A        %7D%0A        out.write(String.valueOf(loader));%0A        out.write(%22%3Cbr/%3E-------------%3Cbr/%3E%22);
 %0A       

Add another classloader test case.