public class HttpDirectoryServlet
extends javax.servlet.http.HttpServlet
HttpDirectoryServlet class is a servlet that acts
as a proxy for client requests to an LDAP Directory over HTTP.
To use this class:
DirectoryServlet (or any
other name you choose) using the following code
import com.entrust.toolkit.util.HttpDirectoryServlet;
public class DirectoryServlet extends com.entrust.toolkit.util.HttpDirectoryServlet {
}
DirectoryServlet into your Web server's
servlet folder. The specific location depends
on the Web server you are using.
The HttpDirectoryServlet class receives the IP address
and port number of your Directory as parameters called directoryIP
and directoryPort. Configure this servlet using these
parameters. Specific configuration details depend on the Web server
you are using. For example, the servletrunner program
that is part of Sun's J2SDK, uses a servlet.properties file
to pass configuration parameters to each servlet. A sample
servlet.properties file for DirectoryServlet
contains the following information:
# Directory servlet
servlet.mainDirectory.code=DirectoryServlet
servlet.mainDirectory.initArgs=\
directoryIP=47.97.235.29,\
directoryPort=389,\
debug=false
If you want to use this example, edit it to reflect the name and URL you choose for your servlet.
If you have several Directories, you can re-use the
HttpDirectoryServlet class.
Wrap it in a second DirectoryServlet class as above, but
give it a different name. For example:
# Directory servlet
servlet.backupDirectory.code=DirectoryServletTwo
servlet.backupDirectory.initArgs=\
directoryIP=47.97.235.30,\
directoryPort=389,\
debug=false
Using the names in this example, the HttpDirectoryClient
communicates with each HttpDirectoryServlet as follows:
LdapDirectory mainDir = new HttpDirectoryClient("http://wothdmontg.entrust.com:80/servlet/mainDirectory", 0);
LdapDirectory backup = new HttpDirectoryClient("http://wothdmontg.entrust.com:80/servlet/backupDirectory", 0);
In this example, the Web server is using port 80 on wothdmontg.entrust.com.
The servlets are located in the server's servlet folder.
HttpDirectoryClient,
Serialized Form| Modifier and Type | Field and Description |
|---|---|
protected HttpDirectoryServletEngine |
httpDirectoryServletEngine |
protected boolean |
m_debug |
| Constructor and Description |
|---|
HttpDirectoryServlet() |
| Modifier and Type | Method and Description |
|---|---|
void |
config(javax.servlet.ServletConfig config)
Provides the ServletConfig data to the servlet superclass without the requirement
of calling
super.init in the subclass. |
void |
doGet(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
Call the
doGet() method in HttpDirectoryServletEngine class. |
java.lang.String |
getServletInfo()
Returns a short description of this servlet
|
void |
init(javax.servlet.ServletConfig config)
Overrides the
init method in the servlet superclass. |
doDelete, doOptions, doPost, doPut, doTrace, getLastModified, service, serviceprotected boolean m_debug
protected HttpDirectoryServletEngine httpDirectoryServletEngine
public void init(javax.servlet.ServletConfig config)
throws javax.servlet.ServletException
init method in the servlet superclass.
This method attempts to establish a connection to the Directory
at the IP address and port number specified in the servlet's
configuration parameters (servlet.properties file)
and throws an exception if it cannot establish a connection.
init in interface javax.servlet.Servletinit in class javax.servlet.GenericServletconfig - the servlet configuration parametersjavax.servlet.ServletExceptionpublic void config(javax.servlet.ServletConfig config)
throws javax.servlet.ServletException
super.init in the subclass.
This is used in place of super.init when overriding the init
function.
config - the servlet configuration parametersjavax.servlet.ServletExceptionpublic java.lang.String getServletInfo()
getServletInfo in interface javax.servlet.ServletgetServletInfo in class javax.servlet.GenericServletpublic void doGet(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
throws javax.servlet.ServletException,
java.io.IOException
Call the doGet() method in HttpDirectoryServletEngine class.
doGet in class javax.servlet.http.HttpServletreq - res - javax.servlet.ServletExceptionjava.io.IOExceptionHttpDirectoryServletEngine