Wednesday, August 22, 2007

CGI variables (Remote_Addr)

here are some examples of getting the CGI variables from a web-agent.

LotusScript
Sub Initialize
Dim session As NotesSession
Set session = New NotesSession
Dim doc As NotesDocument
Set doc = session.DocumentContext
Print "IP address =" + doc.Remote_Addr(0)
End Sub

Java
public class JavaAgent extends AgentBase {
public void NotesMain() {
try {
Session session = getSession();
AgentContext agentContext = session.getAgentContext();
Document doc = agentContext.getDocumentContext();
getAgentOutput().println("IP address = " + doc.getItemValueString("Remote_Addr"));
}
catch(Exception e) {
e.printStackTrace();
}
}
}

No comments :