|
|
From Karl Merckel on the Notes forums:
This solution uses HttpClient and JSSE which you can download from these sources:
HttpClient:
http://jakarta.apache.org/commons/httpclient/index.html
Dependancies:
http://jakarta.apache.org/commons/httpclient/dependencies.html
JSSE1.3
http://java.sun.com/products/jsse/index-103.html
After downloading and unzipping the packages retrieve the following JAR files and put them in jvm\lib\ext
commons-httpclient-3.0.jar
commons-logging.jar
commons-codec-1.3.jar
junit.jar
jcert.jar
jnet.jar
jsse.jar
One last step and I am not sure if this is neccassary:
Modify the java.security document (in /jvm/lib/security) and add a security provider : com.sun.net.ssl.internal.ssl.Provider.
Example :
security.provider.1=sun.security.provider.Sun
security.provider.2=com.sun.net.ssl.internal.ssl.Provider
Modify the java.policy document (in jvm/lib/security) and add a permission :
permission java.util.PropertyPermission "java.protocol.handler.pkgs", "write";
This solution work in ND6+ because it needs JDK 1.3+.
Here is some sample code:
import lotus.domino.*;
import java.io.IOException;
import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.httpclient.*;
import org.apache.commons.httpclient.methods.InputStreamRequestEntity;
import java.io.File;
import java.io.FileInputStream;
public class JavaAgent extends AgentBase {
public void NotesMain() {
try {
Session session = getSession();
AgentContext agentContext = session.getAgentContext();
HttpClient httpclient = new HttpClient();
PostMethod post = new PostMethod("https://yourdomain.com?action=login&username=whatever");
try {
int result = httpclient.executeMethod(post);
// Display status code
System.out.println("Response status code: " + result);
// Display response
System.out.println("Response body: ");
System.out.println(post.getResponseBodyAsString());
} finally {
// Release current connection to the connection pool once you are done
post.releaseConnection();
}
} catch(Exception e) {
e.printStackTrace();
}
}
}