You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Dominic Clay <do...@europrospectus.com> on 2002/06/28 11:50:07 UTC

RE: what is JNDI ??? (Was JNDI - What resources are loaded? )

JAVA NAMING AND DIRECTORY INTERFACETM 

The Java Naming and Directory InterfaceTM (JNDI) is a standard extension to
the JavaTM platform, providing Java technology-enabled applications with a
unified interface to multiple naming and directory services in the
enterprise. As part of the Java Enterprise API set, JNDI enables seamless
connectivity to heterogeneous enterprise naming and directory services.
Developers can now build powerful and portable directory-enabled
applications using this industry standard

http://java.sun.com/products/jndi/


Dominic

-----Original Message-----
From: Power-Netz (Schwarz) [mailto:schwarz@power-netz.de] 
Sent: 28 June 2002 10:41
To: Tomcat Users List
Subject: AW: JNDI - What resources are loaded? 



OT: what is JNDI ???

>
> > Is there a way to list all of the JNDI Resources that are loaded for 
> > a particular context?
>
> Sure.
>
> Here is a snipp from my "JNDI browser" JSP:
>
> <%@ page
>   info="JNDI browser"
>   import="javax.naming.*, javax.sql.*, java.sql.*"
>   contentType="text/html; charset=windows-1250"
> %><%!
> static public String DEF_CPATH = "java:/";
> %><%
> //String contextPath = "java:comp/env/jdbc";
> String contextPath = request.getParameter( "cpath" );
> if( contextPath == null ) {
>   contextPath = DEF_CPATH;
> }
> %>
> <html>
> <head>
> <title>Test - JNDI browser</title>
> <meta http-equiv="Content-Type" content="text/html; 
> charset=windows-1250"> </head>
>
> <body bgcolor="#FFFFFF" text="#000000">
> <h1>JNDI browser</h1>
> <p>Context looked up: <strong><%= contextPath %></strong></p> <%
> InitialContext initCtx;
> Context envCtx;
>
> initCtx = new InitialContext();
> if( (envCtx = (Context)initCtx.lookup( contextPath )) == null ) {
>   out.println( "<p>No " + contextPath + " context</p>" );
> } else {
>   NamingEnumeration enum = initCtx.listBindings( contextPath );
>   int i = 1;
> %>
> <table width="100%" border="1" cellspacing="0" cellpadding="3">
>   <%
>   while( enum.hasMore() ) {
> %>
>   <tr>
>     <td><%= i %></td>
>     <td><%= ((Binding)enum.next()).toString() %></td>
>   </tr>
> <%
>   }
> %>
> </table>
> </body>
> </html>
>
> Nix.
>


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>