swirl
Guide to OmniMark 9   OmniMark home
docs home 
IndexConceptsTasksSyntaxLibrariesLegacy LibrariesErrors
 
  Related Topics   Other Library Functions  
function  

HttpObjectSetCookieAttribute

 
 

Library: HTTP support (OMHTTP)
Include: omhttp.xin

Declaration

define function HttpObjectSetCookieAttribute
               modifiable  stream HttpObject
   for         value       stream CookieName
   attribute   value       stream AttrName
   to          value       stream AttrValue

Argument definitions

HttpObject
is an HTTP request or HTTP response object (input argument).
CookieName
is the name of the cookie. Note that any preceding "$" symbol should be omitted (input argument).
AttrName
is the name of the cookie attribute (input argument).
AttrValue
is the value to assign to the cookie attribute (input argument).


Purpose

Use HttpObjectSetCookieAttribute to set a named attribute value for a cookie header in an HTTP request or response object.

Requirements

You must include the following line at the beginning of your OmniMark program:


  include "omhttp.xin"

Usage Notes

If a nonexistent cookie name is specified, the HTTP object will be in error. Usually, HttpObjectSetCookieAttribute is called in a server program.

Examples

Set both request and response cookie attributes.


  ; HttpObjectSetCookieAttribute
  include "omhttp.xin"
  
  process
  
     local HttpRequest my-Request
     local HttpResponse my-Response
  
     HttpObjectSetCookieAttribute my-Request
        for "DocUserID" attribute "Domain" to "www.stilo.com"
     HttpObjectSetCookieAttribute my-Response
        for "DocUserID" attribute "Domain" to "www.stilo.com"

Create a function to set cookie attributes.


  include "omhttp.xin"
  
  define function SetUserIdCookie
    (modifiable stream http-object,
     value      stream cookie-name,
     value      stream cookie-value,
     value      stream user-id)
  as
    HttpObjectSetCookieValue http-object for cookie-name to user-id
    HttpObjectSetCookieAttribute http-object
      for cookie-name attribute "Domain" to "www.stilo.com"
    HttpObjectSetCookieAttribute http-object
      for cookie-name attribute 'Path' to '/'

The following line calls the above function:


  SetUserIdCookie(my-http-object, cookie-name, cookie-value, user-id)

    Related Topics
 
Other Library Functions
 
 

Top [ INDEX ] [ CONCEPTS ] [ TASKS ] [ SYNTAX ] [ LIBRARIES ] [ LEGACY LIBRARIES ] [ ERRORS ]

OmniMark 9.1.0 Documentation Generated: September 2, 2010 at 1:38:10 pm
If you have any comments about this section of the documentation, please use this form.

Copyright © Stilo International plc, 1988-2010.