9.3.4. The HTTP InitialContext Factory Implementation
Contextinterface. Operations through the
Contextinterface are translated into HTTP posts to a servlet that passes the request to the NamingService using its JMX invoke operation. Advantages of using HTTP as the access protocol include better access through firewalls and proxies setup to allow HTTP, as well as the ability to secure access to the JNDI service using standard servlet role based security.
org.jboss.naming.HttpNamingContextFactoryas the factory implementation. The complete set of support
InitialContextenvironment properties for this factory are:
- java.naming.factory.initial: The name of the environment property for specifying the initial context factory, which must be
- java.naming.provider.url (or
Context.PROVIDER_URL): This must be set to the HTTP URL of the JNDI factory. The full HTTP URL would be the public URL of the JBoss servlet container plus
/invoker/JNDIFactory. Examples include:
The first example accesses the servlet using the port 8080. The second uses the standard HTTP port 80, and the third uses an SSL encrypted connection to the standard HTTPS port 443.
- java.naming.factory.url.pkgs: For all JBoss JNDI provider this must be
org.jboss.naming:org.jnp.interfaces. This property is essential for locating the
java:URL context factories of the JBoss JNDI provider.
Contextimplementation returned by the
HttpNamingContextFactoryis a proxy that delegates invocations made on it to a bridge servlet which forwards the invocation to the
NamingServicethrough the JMX bus and marshals the reply back over HTTP. The proxy needs to know what the URL of the bridge servlet is in order to operate. This value may have been bound on the server side if the JBoss web server has a well known public interface. If the JBoss web server is sitting behind one or more firewalls or proxies, the proxy cannot know what URL is required. In this case, the proxy will be associated with a system property value that must be set in the client VM. For more information on the operation of JNDI over HTTP see Section 9.4.1, “Accessing JNDI over HTTP”.