Deploying and Utilizing LotusScript Agents

LotusScript and Java are usually used to write agents for the Web. Simple Actions are not supported and @Functions don't allow data to be returned.

LotusScript agents are executed from the WebQueryOpen and WebQuerySave events (as discussed in the “Deploying and Utilizing LotusScript” section in Chapter 14) and also from the OpenAgent URL command.

The NotesSession.DocumentContext property returns a NotesDocument when a LotusScript agent is executed from these events. The NotesDocument contains Web session information, CGI variables associated with the session, and access to all document items. The following code shows how to access these CGI variables:

Dim session As New NotesSession
Dim context As NotesDocument
Dim CGIValue As String
Set context = session.DocumentContext

CGIValue = context.HTTP_USER_AGENT(0)
Set webUserName = context.remote_user(0)

Domino design elements are easy and efficient, but you also can use agents to create Web pages. In LotusScript agents, the output is created with the Print statement. An agent can print three types of output:

  • Data to be displayed on the Web (this could be an HTML page)

  • URL to redirect, coded in square ([]) brackets

  • URL to a new site, coded in double square ([[]]) brackets

Deploying and utilizing LotusScript is also discussed further in Chapter 14.

As an application designer, you also must think about basic security. A user may issue the Domino URL command ?OpenAgent repeatedly, tying up resources and causing a Denial of Service attack. To prevent users from issuing the URL command by themselves, check the HTTP_REFERRER CGI variable at the beginning of your LotusScript agent. This variable tracks the source of the Web request; a returned value of blank indicates the URL was entered directly. With this information, you can terminate agents before they do any harm to your system.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.116.21.229