Author: markt
Date: Wed Dec 16 11:04:24 2009
New Revision: 891186

URL: http://svn.apache.org/viewvc?rev=891186&view=rev
Log:
Side issues from bug 47841
Override getInfo() log messages that use it have useful info
Add support for a connectionTimeout attribute

Modified:
    tomcat/trunk/java/org/apache/catalina/realm/JNDIRealm.java
    tomcat/trunk/webapps/docs/config/realm.xml

Modified: tomcat/trunk/java/org/apache/catalina/realm/JNDIRealm.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/realm/JNDIRealm.java?rev=891186&r1=891185&r2=891186&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/realm/JNDIRealm.java (original)
+++ tomcat/trunk/java/org/apache/catalina/realm/JNDIRealm.java Wed Dec 16 
11:04:24 2009
@@ -380,6 +380,12 @@
     protected String commonRole = null;
 
 
+    /**
+     * The timeout, in milliseconds, to use when trying to create a connection
+     * to the directory. The default is 5000 (5 seconds).
+     */
+    protected String connectionTimeout = "5000";
+    
     // ------------------------------------------------------------- Properties
 
     /**
@@ -870,6 +876,41 @@
     }
 
 
+    /**
+     * Return the connection timeout.
+     */
+    public String getConnectionTimeout() {
+
+        return connectionTimeout;
+
+    }
+
+
+    /**
+     * Set the connection timeout.
+     *
+     * @param timeout The new connection timeout
+     */
+    public void setConnectionTimeout(String timeout) {
+
+        this.connectionTimeout = timeout;
+
+    }
+
+
+    /**
+     * Return descriptive information about this Realm implementation and
+     * the corresponding version number, in the format
+     * <code>&lt;description&gt;/&lt;version&gt;</code>.
+     */
+    @Override
+       public String getInfo() {
+
+        return info;
+
+    }
+
+
     // ---------------------------------------------------------- Realm Methods
 
 
@@ -1962,6 +2003,8 @@
             env.put(Context.REFERRAL, referrals);
         if (derefAliases != null)
             env.put(JNDIRealm.DEREF_ALIASES, derefAliases);
+        if (connectionTimeout != null)
+               env.put("com.sun.jndi.ldap.connect.timeout", connectionTimeout);
 
         return env;
 

Modified: tomcat/trunk/webapps/docs/config/realm.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/config/realm.xml?rev=891186&r1=891185&r2=891186&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/config/realm.xml (original)
+++ tomcat/trunk/webapps/docs/config/realm.xml Wed Dec 16 11:04:24 2009
@@ -336,6 +336,12 @@
         property.</p>
       </attribute>
 
+      <attribute name="connectionTimeout" required="false">
+        <p>The timeout in milliseconds to use when establishing the connection
+        to the LDAP directory. If not specified, a value of 5000 (5 seconds) is
+        used.</p>
+      </attribute>
+
       <attribute name="connectionURL" required="true">
         <p>The connection URL to be passed to the JNDI driver when
         establishing a connection to the directory.</p>



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to