Is it possible to get "everything" from javax.naming.InitialContext?

Is it possible to get "all" (all names) from javax.naming.InitialContext ? I did not find examples or documentation about this.

+6
java jndi
source share
2 answers

Looking at JavaDoc, I see that .list (String name) will return a list of names in a named context and that .getNameInNamespace () will return the name InitialContext. Therefore, perhaps you can do:

 ctx.list(ctx.getNameInNamespace()); 
+6
source share

It is as simple as:

ctx.list("")

+3
source share

All Articles