Friday, October 06, 2006

developerWorks: Ajax Resource Center

Thursday, October 05, 2006

CGI Variable Examples

As mentioned on the Taking Notes podcast episode 34, 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();
}
}
}