Hi all,
We are trying to use the:
NotesFactory.createSession(host, stringToken)
method. But this does not seem to work.
I have created a simple test servlet which describes my problem probably best.
The problem is that no matter what I do, I keep getting the error:
Cookie is invalid.
My testing servlet is behind a Lotus Notes login-screen. So I use Notes authentication.
I don’t know what to do. Can somebody please help? Below I have posted the full code listing of my ‘testing-servlet’.
==============================================
package nl.informatiefabriek.tokentest;
import java.io.IOException;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import lotus.domino.NotesException;
import lotus.domino.NotesFactory;
import lotus.domino.Session;
/**
-
Simple test servlet to test notes login, using the
-
NotesFactory.createSession(host, tokenString) method.
*/
public class TokenTestServlet extends HttpServlet {
private ServletConfig config;
/**
* Get's called when the servlet is loaded. We just save the
* intialisation configuration.
*/
public void init(ServletConfig config) throws ServletException {
this.config = config;
}
/**
* Get's called by Servlet container when user makes a request.
*/
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException
{
Cookie[] cookies = request.getCookies();
String id = null;
for (int i=0 ; i<cookies.length; i++) {
String name = cookies[i].getName();
if (name.equals("DomAuthSessId")) {
id = cookies[i].getValue();
}
}
Session s = null;
try {
s = NotesFactory.createSession("aphrodite:60148", id);
System.out.println("Platform: " + s.getPlatform());
System.out.println("Username: " + s.getUserName());
} catch (NotesException e) {
System.out.println("Exception occured: " + e.text);
} finally {
try {
s.recycle();
} catch (Exception e) {}
}
}
}
==============================================
Many Thanks, Cheers,
Harm de Laat
Informatiefabriek
The Netherlands