swirl
Guide to OmniMark 7   OmniMark home
docs home 
IndexConceptsTasksSyntaxLibrariesLegacy LibrariesErrors
 
  Related Syntax     Other Library Functions  
function  

HttpObjectSetCookieAttribute

 
 

Library: Net, 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.omnimark.com"
     HttpObjectSetCookieAttribute my-Response
        for "DocUserID" attribute "Domain" to "www.omnimark.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.omnimark.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 Syntax
   HttpObjectSetCookieValue
   HttpObjectGetCookieAttributes
   HttpObjectGetCookieValues
 
  Other Library Functions
   HttpConnectionSendResponse
   HttpLibraryVersion
   HttpObjectGetCookieAttributes
   HttpObjectGetCookieValues
   HttpObjectGetHeaders
   HttpObjectGetStatusReport
   HttpObjectIsInError
   HttpObjectSetCookieAttribute
   HttpObjectSetCookieValue
   HttpObjectSetHeader
   HttpRequest
   HttpRequestGetSearchItems
   HttpRequestSend
   HttpRequestSetFromUrl
   HttpRequestSetProxy
   HttpRequestSetSearchItem
   HttpResponse
   HttpResponseOutput
   HttpServiceAwaitRequest
 
 

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

OmniMark 7.1.2 Documentation Generated: June 28, 2005 at 5:45:18 pm
If you have any comments about this section of the documentation, send email to [email protected]

Copyright © Stilo Corporation, 1988-2005.