Question:
How can we read the parameter par1 set into the Header?
Using a simple call code action (ran on Notes client -> Action):
============================
Dim session As New NotesSession
Dim webRequest As NotesHTTPRequest
Dim url as String
Dim out as string
url:="https://HOSTNAMEDOMINOSERVER/PATHDB/AGENTNAME?OpenAgent"
Set webRequest = session.CreateHTTPRequest()
Call webRequest.ResetHeaders()
Call webRequest.SetHeaderField("par1", |testblabbla|)
out=webRequest.Get(urlagent)
This is the NotesAgent
===========================
Dim s As NotesSession
Dim doc As NotesDocument
Set s = New NotesSession
Set doc = s.documentcontext
If doc.QUERY_STRING_DECODED(0)<>"" Then'it's a GET
myQuerystring = doc.QUERY_STRING_DECODED(0)+"&cond=1"
ElseIf doc.QUERY_STRING(0)<>"" Then
myQuerystring = doc.QUERY_STRING(0)+"&cond=2"
'decode it !
ElseIf doc.REQUEST_CONTENT(0)<>"" Then'it's a POST
myQuerystring = doc.REQUEST_CONTENT(0)+"&cond=3" ' WARNING this is for POST but you will have to decode !!!
'decode it !
Else
Print "error"
End If
Print myQuerystring
========================
the generated output for the agent
=================
<html>
<head>
</head>
<body text="#000000">
OpenAgent&cond=1
</body>
</html>
=============
Answer:
Apparently CGI doesn't provide a mean to expose custom headers. And the headers are meant to be directives for the end or intermediate devices to act upon if they're interested. The application-specific data should go to where the application can get to.
The suggestion at this time:
a) adding this name-value pair as URL params and use Query_String_Decoded to get to this.
b) If the value gets too long, you can do a POST and shove this name-value in to the Http payload. The document context would have this Notes field/value because that's where the application is expected to get it.
Request:
Please consider whether to extend the CGI or something else within a NotesAgent in order to read these headers.