We help IT Professionals succeed at work.

Returning Active Directory Codes with Java Servlet

oneDayAtaTime
on
I have a Java Servlet that authenticates users against Active Directory. I need for my servlet to return active directory error codes, such as 525, 533, etc, and their associated messages. Can anyone advise me on how to call these codes in my servlet? I'd also like it to return a code if it's successful, but am not sure what that code would be.
Comment
Watch Question

Database Administrator / Software Engineer
Commented:
            Hi!

Here are several Java LDAP examples that you can look at
http://www.java2s.com/Code/Java/JNDI-LDAP/SearchingaSubtreeintheDirectory.htm
http://www.java2s.com/Code/Java/JNDI-LDAP/howtosearchthedirectorythatignoresreferralsreturnedbytheserver.htm
http://www.java2s.com/Code/Java/JNDI-LDAP/CatalogJNDI-LDAP.htm
Other LDAP links
http://java.sun.com/docs/books/tutorial/jndi/newstuff/paged-results.html
http://java.sun.com/j2se/1.5.0/docs/api/javax/naming/NamingException.html
http://java.sun.com/products/jndi/tutorial/ldap/models/exceptions.html

The first link is showing a search example where the main function is throwing and Excepction.
In stead of throwing an exception then you catch it (see link 2)  and you return the Exception to the user using the
Printwriter out object of the HttpResponse of the servlet.

Hope this helps.
Regards,
      Tomas Helgi