Javax Naming Java by API

import java.io.IOException;
import java.io.PrintWriter;
import javax.naming.Binding;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class EnvEntry extends HttpServlet {
  public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException,
      IOException {
    res.setContentType("text/plain");
    PrintWriter out = res.getWriter();
    try {
      Context initCtx = new InitialContext();
      NamingEnumeration e = initCtx.listBindings("java:comp/env");
      while (e.hasMore()) {
        Binding binding = (Binding) e.next();
        out.println("Name: " + binding.getName());
        out.println("Type: " + binding.getClassName());
        out.println("Value: " + binding.getObject());
        out.println();
      }
    } catch (NamingException e) {
      e.printStackTrace(out);
    }
  }
}