views:

1355

answers:

2

Hi All,

In my Java web application, the NTLM domain controller name is specified in web.xml like this:

<filter>
<!-- other code -->
    <init-param>
        <param-name>jcifs.http.domainController</param-name>
        <param-value>DCNAME</param-value>
   </init-param>
<!-- other code -->
</filter>

In the above XML, we've hard-coded the domain controller name (DCNAME) in the param-value tag.

Now, is it possible to read this 'DCNAME' from a JNDI variable, instead of hard-coding it in web.xml file?

thanks in advance.

A: 

Can read it inside the init() of the servlet using JNDI to which you are passing this param.

Nrj
+1  A: 

See this link. You need to define an environment resource like this:

 <Environment name="myName" value="whatever"
         type="java.lang.String" override="false"/>

and then read it from code:

Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
String myName = (String) envCtx .lookup("myName");
kgiannakakis