Page 1 sur 1

Agent web et headers HTTP personnalisés

MessagePublié: 21 Fév 2006 à 00:28
par Thothem
Normalement, lorsqu'un agent est activé par son URL, Domino génère une réponse de type text/html et encadre la sortie de l'agent par des tags html de haut niveau (<html><head>...</body></html>), mais en printant avant tout autre chose des lignes de headers http (qui seront pour certains effectivement transmis au navigateur), alors il est possible d'avoir un contrôle plus grand du corps de la réponse.

exemples:
'-- Générer du xml
Sub Initialize
Print "Content-Type: text/xml"

Print "<?xml version=""1.0"" ?>"
Print "<doc>"
Print "<text>hello</text>"
Print "</doc>"
End Sub

'-- Générer du html
Sub Initialize
Print "Content-Type: text/html"

Print "<html>"
Print "<head>"
Print "<title>Coucou</title>"
Print "</head>"
Print {<body onload="alert('coucou')">}
Print {
plein de truc
...
}
Print </body></html>"
End Sub

'-- Une redirection "propre"
Sub Initialize
Print "Location: http://www.monsite.fr"
Print
End Sub

'-- Poser/retirer un cookie
Sub Initialize
Print |Set-Cookie: DomAuthSessId=; expires=Saturday, 01-Apr-2200 08:00:00 GMT ; path=/|
End Sub

etc.

c'est pas grand chose, mais c'est toujours ça de gratté.