mn8 Language Reference | Index    

Cookie

SUMMARY: ATTRIBUTES SUMMARY  NO ELEMENTS  CONSTRUCTORS SUMMARY  NO OPERATORS  METHODS SUMMARYDETAIL: ATTRIBUTE DETAILS  NO ELEMENTS  CONSTRUCTOR DETAILS  NO OPERATORS  METHOD DETAILS

Description

The purpose of Cookie concept is to assist the navigation and retrieval process in the exploration of the hidden web (dynamically generated web pages).
This is achieved through:

The Cookie concept does not have any special methods. These concepts are created automaticaly by the HTTP handler from the HTTP headers and stored in the mem://hyper/http/cookies/ memory context as a Series , and should be seen only as bags of information. Cookie can be also created by users and stored in the same memory context in order to automatize / customize the navigation process on some specific sites.

Usage

assume that we have a Series containing cookies and serialized somewhere. Now we load them

            # create a new cookie concept
            $jguru_cookie TYPEOF Cookie

            # we want automatic login
            $jguru_cookie@name = "auto_login_mchale"
            $jguru_cookie@value = "TRUE"
            $jguru_cookie@domain = "www.jguru.com"
            $jguru_cookie@path = "/"
            $jguru_cookie.storeCookie

            # we have also to have our UIN
            $jguru_cookie@name = "unique_id"
            $jguru_cookie@value = "9698986dfdd9dsid98423..."
            $jguru_cookie@domain = "www.jguru.com"
            $jguru_cookie@path = "/"
            $jguru_cookie.storeCookie

            # now we can go to our homepage at jguru.com
            $page FROM "http://www.jguru.com"

Version: 0.1
Authors:Remus Pereni (http://neuro.nolimits.ro)
Location:
Inherits: Concept

Attribute List

 @domain TYPEOF String LABEL "domain"
 @expires TYPEOF String LABEL "expires"
 @name TYPEOF String LABEL "name"
 @path TYPEOF String LABEL "path"
 @secure TYPEOF String LABEL "secure"
 @value TYPEOF String LABEL "value"
top

Constructor List

create (String $cookieContent, String $domain)
create
top

Method List

static convertExplorerCookies (String $cookieFile, String $cookieDir)
static convertKonquerorCookies (String $cookieFile, String $cookieDir)
static convertNetscapeCookies (String $cookieFile, String $cookieDir)
static convertOperaCookies (String $cookieFile, String $cookieDir)
static StringgetCookieString (String $uri)
static SeriesgetCookiesFromDB (String $uri)
saveCookie (String $saveDir)
setDomain (String $newDomain)
setExpires (String $expires)
setName (String $newName)
setPath (String $newPath)
setSecure (String $secure)
setValue (String $newValue)
storeCookie
StringtoTXT
StringtoXML
top
Methods inherited from: Concept
cloneConcept, extendsConcept, fromXML, getAllInheritedConcepts, getConceptAttribute, getConceptAttributeField, getConceptAttributeFields, getConceptAttributes, getConceptConstructors, getConceptElement, getConceptElementField, getConceptElementFields, getConceptElements, getConceptLabel, getConceptMethod, getConceptMethods, getConceptOperators, getConceptType, getErrorHandler, getInheritedConcepts, getResourceURI, hasConceptAttribute, hasConceptElement, hasConceptMethod, hasPath, isHidden, loadContent, setConceptLabel, setErrorHandler, setHidden, setShowEmpty, showEmpty, toTXT, toXML, setResourceURI

Detailed Attribute Info

@domain

Label:domain
Type:String
Is Static:false
Is Hidden:false
Show Empty:true

When searching the cookie list for valid cookies, a comparison of the domain attributes of the cookie is made with the Internet domain name of the host from which the URL will be fetched. If there is a tail match, then the cookie will go through path matching to see if it should be sent.

top

@expires

Label:expires
Type:String
Is Static:false
Is Hidden:false
Show Empty:true

The expires attribute specifies a date string that defines the valid life time of that cookie. Once the expiration date has been reached, the cookie will no longer be stored or given out.

top

@name

Label:name
Type:String
Is Static:false
Is Hidden:false
Show Empty:true

This string is a sequence of characters excluding semi-colon, comma and white space. If there is a need to place such data in the name or value, some encoding method such as URL style %XX encoding is recommended, though no encoding is defined or required.

top

@path

Label:path
Type:String
Is Static:false
Is Hidden:false
Show Empty:true

The path attribute is used to specify the subset of URLs in a domain for which the cookie is valid. If a cookie has already passed domain matching, then the pathname component of the URL is compared with the path attribute, and if there is a match, the cookie is considered valid and is sent along with the URL request. The path "/foo" would match "/foobar" and "/foo/bar.html". The path "/" is the most general path.

top

@secure

Label:secure
Type:String
Is Static:false
Is Hidden:false
Show Empty:true

If a cookie is marked secure, it will only be transmitted if the communications channel with the host is a secure one. Currently this means that secure cookies will only be sent to HTTPS (HTTP over SSL) servers. If secure is not specified, a cookie is considered safe to be sent in the clear over unsecured channels.

top

@value

Label:value
Type:String
Is Static:false
Is Hidden:false
Show Empty:true

This string is a sequence of characters excluding semi-colon, comma and white space. If there is a need to place such data in the name or value, some encoding method such as URL style %XX encoding is recommended, though no encoding is defined or required.

top

Detailed Constructor Info

create (String $cookieContent, String $domain)
Parameters:
$cookieContent :The content of this Cookie.
$domain :The domain.

Constructs a new Cookie concept with the specified content and domain.

top
create

Constructs a new empty Cookie concept.

top

Detailed Method Info

static convertExplorerCookies (String $cookieFile, String $cookieDir)
Parameters:
$cookieFile :The cookie file to convert.
$cookieDir :The directory in which the converted cookie will be placed.
Returns:

Converts the specified eplorer cookie file to xml files and put them in the specified directory.

            Cookie.convertExplorerCookies("C:\windows\Cookies\", "/home/user/cookies/")
            

top
static convertKonquerorCookies (String $cookieFile, String $cookieDir)
Parameters:
$cookieFile :The cookie file to convert.
$cookieDir :The directory in which the converted cookie will be placed.
Returns:

Converts the specified konqueror cookie file to xml files and put them in the specified directory.

            Cookie.convertExplorerCookies("/home/user/.kde/share/apps/kcookiejar/cookies", "/home/user/cookies/")
            

top
static convertNetscapeCookies (String $cookieFile, String $cookieDir)
Parameters:
$cookieFile :The cookie file to convert.
$cookieDir :The directory in which the converted cookie will be placed.
Returns:

Converts the specified netscape cookie file to xml files and put them in the specified directory.

            Cookie.convertNetscapeCookies("/home/user/.netscape/cookies", "/home/user/cookies/")
            

top
static convertOperaCookies (String $cookieFile, String $cookieDir)
Parameters:
$cookieFile :The cookie file to convert.
$cookieDir :The directory in which the converted cookie will be placed.
Returns:

Converts the specified opera cookie file to xml files and put them in the specified directory.

            Cookie.convertExplorerCookies("/home/user/.opera/cookies4.dat", "/home/user/cookies/")
            

top
static getCookieString (String $uri)
Parameters:
$uri :The searched uri.
Returns: String
Exceptions:
badURLException :
(Error)
If the URL to the search the cookie isn't valid.

Returns a String concept with all cookies from user's home directory which contains the specified uri.

            $cookie typeof Cookie                                                           
            $cookie.setDomain("www.google.com")                                             
            $cookie.setExpires("1027358757935")                                             
            $cookie.setName("google_settings")                                              
            $cookie.setPath("/")                                                            
            $cookie.setSecure("FALSE")                                                       
            $cookie.setValue("OrZettS7zZIAADc4y3U")                                         
            $cookie.storeCookie                                                             
            print Cookie.getCookieString("http://www.google.com")
            -- the result is --
            google_settings=OrZettS7zZIAADc4y3U
            

top
static getCookiesFromDB (String $uri)
Parameters:
$uri :The searched uri.
Returns: Series
Exceptions:
badURLException :
(Error)
If the URL to the search the cookie isn't valid.

Returns a Series concept with all cookies as Cookie concepts from user's home directory which contains the specified uri.

            $cookie typeof Cookie                                                           
            $cookie.setDomain("www.google.com")                                             
            $cookie.setExpires("1027358757935")                                             
            $cookie.setName("google_settings")                                              
            $cookie.setPath("/")                                                            
            $cookie.setSecure("FALSE")                                                       
            $cookie.setValue("OrZettS7zZIAADc4y3U")                                         
            $cookie.storeCookie                                                             
            print Cookie.getCookiesFromDB("http://www.google.com")
            -- the result is --
            Name   : google_settings
            Value  : OrZettS7zZIAADc4y3U
            Domain : www.google.com
            Path   : /
            Expires: 1027358757935
            Secure : FALSE
            

top
saveCookie (String $saveDir)
Parameters:
$saveDir :The directory in which will be saved this cookie.
Returns:

Saves this cookie concept to the specified directory.

            $cookie typeof Cookie
            $cookie typeof Cookie
            $cookie.setDomain("www.google.com")
            $cookie.setExpires("1027358757935")
            $cookie.setName("google_settings")
            $cookie.setPath("/")
            $cookie.setSecure("FALSE")
            $cookie.setValue("OrZettS7zZIAADc4y3U")
            $cookie.saveCookie("/home/user/cookies/")
            

top
setDomain (String $newDomain)
Parameters:
$newDomain :The new domain to be set.
Returns:

Sets this cookie domain to the value specified in parameter.

            $cookie typeof Cookie
            $cookie.setDomain("www.google.com")
            print $cookie
            -- the result is --
            Name   : 
            Value  : 
            Domain : www.google.com
            Path   : 
            Expires: 
            Secure :
            

top
setExpires (String $expires)
Parameters:
$expires :The new expiration to be set.
Returns:

Sets this cookie expiration to the value given as parameter.

            $cookie typeof Cookie
            $cookie.setExpires("1027358757935")
            print $cookie
            -- the result is --
            Name   : 
            Value  : 
            Domain : 
            Path   : 
            Expires: 1027358757935
            Secure :
            

top
setName (String $newName)
Parameters:
$newName :The new name to be set.
Returns:

Sets this cookie name to the value given as parameter.

            $cookie typeof Cookie
            $cookie.setName("google_settings")
            print $cookie
            -- the result is --
            Name   : google_settings
            Value  : 
            Domain : 
            Path   : 
            Expires: 
            Secure :
            

top
setPath (String $newPath)
Parameters:
$newPath :The new path to be set.
Returns:

Sets this cookie path to the value given as parameter.

            $cookie typeof Cookie
            $cookie.setPath("/")
            print $cookie
            -- the result is --
            Name   : 
            Value  : 
            Domain : 
            Path   : /
            Expires: 
            Secure :
            

top
setSecure (String $secure)
Parameters:
$secure :The new secure to be set.
Returns:

Sets this cookie secure to the value given as parameter.

            $cookie typeof Cookie
            $cookie.setSecure("TRUE")
            print $cookie
            -- the result is --
            Name   : 
            Value  : 
            Domain : 
            Path   : 
            Expires: 
            Secure : TRUE
            

top
setValue (String $newValue)
Parameters:
$newValue :The new value to be set.
Returns:

Sets this cookie value to the value given as parameter.

            $cookie typeof Cookie
            $cookie.setValue("OrZettS7zZIAADc4y3U")
            print $cookie
            -- the result is --
            Name   : 
            Value  : OrZettS7zZIAADc4y3U
            Domain : 
            Path   : 
            Expires: 
            Secure : 
            

top
storeCookie
Returns:

Saves this cookie concept to the user's home directory.

            $cookie typeof Cookie
            $cookie typeof Cookie
            $cookie.setDomain("www.google.com")
            $cookie.setExpires("1027358757935")
            $cookie.setName("google_settings")
            $cookie.setPath("/")
            $cookie.setSecure("FALSE")
            $cookie.setValue("OrZettS7zZIAADc4y3U")
            $cookie.storeCookie
            

top
toTXT
Returns: String

Returns a stream representing the simple text rendering of this concept.

            $cookie typeof Cookie
            $cookie.setDomain("www.google.com")
            $cookie.setExpires("1027358757935")
            $cookie.setName("google_settings")
            $cookie.setPath("/")
            $cookie.setSecure("TRUE")
            $cookie.setValue("OrZettS7zZIAADc4y3U")
            print $cookie.toTXT
            -- the result is --
            Name   : google_settings
            Value  : OrZettS7zZIAADc4y3U
            Domain : www.google.com
            Path   : /
            Expires: 1027358757935
            Secure : TRUE
            

top
toXML
Returns: String

Returns a stream representing the XML rendering of this concept.

            $cookie typeof Cookie
            $cookie.setDomain("www.google.com")
            $cookie.setExpires("1027358757935")
            $cookie.setName("google_settings")
            $cookie.setPath("/")
            $cookie.setSecure("TRUE")
            $cookie.setValue("OrZettS7zZIAADc4y3U")
            print $cookie.toXML
            -- the result is --
            <?xml version="1.0"?>
            <cookie version="0">
                <domain>www.google.com</domain>
                <path>/</path>
                <secure>TRUE</secure>
                <expires>1027358757935</expires>
                <name>google_settings</name>
                <value>OrZettS7zZIAADc4y3U</value>
            </cookie>
            

top