HTTP Service User's Guide

Version 2.0.4

Last updated: January 30, 2006


Table of Contents


Description

The HTTP service is an external STAF service that provides the ability to quickly and easily make HTTP requests. These requests can be grouped together in a session. Performing requests in a session provides the ability simulate a browsing experience. Since a session provides memory about the last request it is possible to manipulate cookies, login into secure http sites, and interact with form and link html elements that are returned from requests.

Software Requirements

This service requires:

Registration

The HTTP service is an external STAF service written in Java. Since it is an external service, it must be registered with a SERVICE configuration statement in the STAF configuration file (or it can be dynamically registered using the SERVICE service's ADD SERVICE request).

The syntax to register the service is:

SERVICE <Service Name> LIBRARY JSTAF EXECUTE <Service Jar File Name>

<Service Name> is the name by which the HTTP service will be known on this machine.

<Service Jar File Name> is the fully-qualified name of the STAFHTTP.jar file.

Examples

SERVICE Http LIBRARY JSTAF EXECUTE {STAF/Config/STAFRoot}/services/STAFHTTP.jar
SERVICE Http LIBRARY JSTAF EXECUTE C:/STAF/services/STAFHTTP.jar
SERVICE Http LIBRARY JSTAF EXECUTE /usr/local/staf/services/STAFHTTP.jar

Request Syntax

OPEN    SESSION
CLOSE   SESSION <Session>
LIST    SESSIONS
LIST    <FORMS | LINKS | COOKIES | DEFAULTHEADERS | AUTHENTICATIONHOSTS |
        CONTROLNAMES FORM [NAME <Form Name> | ID <Id> | INDEX <Index>]>
        SESSION <Session>
QUERY   SESSION <Session>
GET     SESSION <Session> CONTENT [FILE <File Name> [TOMACHINE <Machine>]]

REQUEST METHOD <Http Method> URL <Target Url> [CONTENT <Content>]
        [HEADER <Key>=<Value>]... [PARAMETER <Key>=<Value>]...
        [CONTENTFILE <Key>=<File Name>]...
        [FOLLOWREDIRECT | DONOTFOLLOWREDIRECT] [SESSION <Session>]
        [FILE <Filename> [TOMACHINE <Machine>]]
        [IGNOREERRORS] [NOSTATUS] [RETURNHEADERS] [RETURNNOCONTENT]
DOPOST  URL <Target Url> [CONTENT <Content>]
        [HEADER <Key>=<Value>]... [PARAMETER <Key>=<Value>]...
        [CONTENTFILE <Key>=<File Name>]...
        [FOLLOWREDIRECT | DONOTFOLLOWREDIRECT] [SESSION <Session>]
        [FILE <Filename> [TOMACHINE <Machine>]]
        [IGNOREERRORS] [NOSTATUS] [RETURNHEADERS] [RETURNNOCONTENT]
DOGET   URL <Target Url> [CONTENT <Content>]
        [HEADER <Key>=<Value>]... [PARAMETER <Key>=<Value>]...
        [FOLLOWREDIRECT | DONOTFOLLOWREDIRECT] [SESSION <Session>]
        [FILE <Filename> [TOMACHINE <Machine>]]
        [IGNOREERRORS] [NOSTATUS] [RETURNHEADERS] [RETURNNOCONTENT]

SET     <FOLLOWREDIRECT | DONOTFOLLOWREDIRECT> SESSION <Session>

QUERY   AUTHENTICATIONHOST <Host> SESSION <Session>
SET     AUTHENTICATIONHOST <Host> AUTHENTICATIONUSER <User>
        [AUTHENTICATIONPASSWORD <Password>] [AUTHENTICATIONDOMAIN <Domain>]
        SESSION <Session>
DELETE  AUTHENTICATIONHOST <Host> SESSION <Session>

QUERY   DEFAULTHEADER <Key> SESSION <Session>
SET     DEFAULTHEADER <Key> VALUE <Value> SESSION <Session>
DELETE  DEFAULTHEADER <Key> SESSION <Session>

QUERY   COOKIE NAME <Name> SESSION <Session>
SET     COOKIE <NAME <Name> VALUE <Value>> | <POLICY <policy>>
        SESSION <Session>
DELETE  COOKIE NAME <Name> SESSION <Session>

QUERY   FORM [NAME <Form Name> | ID <Id> | INDEX <Index>] [CONTROLNAME <Name>]
        SESSION <Session>
SET     FORM [NAME <Form Name> | ID <Id> | INDEX <Index>]
        CONTROLNAME <Name> VALUE <Value> SESSION <Session>
SUBMIT  FORM [NAME <Form Name> | ID <Id> | INDEX <Index>] SESSION <Session>
        [FOLLOWREDIRECT | DONOTFOLLOWREDIRECT]
        [FILE <Filename> [TOMACHINE <Machine>]]
        [IGNOREERRORS] [NOSTATUS] [RETURNHEADERS] [RETURNNOCONTENT]
RESET   FORM [NAME <Form Name> | ID <Id> | INDEX <Index>] SESSION <Session>

QUERY   LINK <NAME <Name> | ID <Id> | INDEX <Index>> SESSION <Session>
FOLLOW  LINK <NAME <Name> | ID <Id> | INDEX <Index>> SESSION <Session>
        [FOLLOWREDIRECT | DONOTFOLLOWREDIRECT]
        [FILE <Filename> [TOMACHINE <Machine>]]
        [IGNOREERRORS] [NOSTATUS] [RETURNHEADERS] [RETURNNOCONTENT]

HELP

VERSION

Session Management

OPEN SESSION

This command opens a new web session. It returns the session id of the new session. The owner of the new session is identified by the machine, process, and handle used to issue the OPEN command.

Syntax

OPEN    SESSION

SESSION specifies to open a new session.

Security

This command requires trust level 3 or higher.

Results

If successful, the result buffer will contain the id of the new session.

Examples

Goal: Create a new session.

OPEN SESSION

CLOSE SESSION

This command closes a session. This is automatically done when the HTTP service is terminated. Once a session is closed it is no longer accessible. The session id is recycled for the next OPEN request.

Syntax

CLOSE   SESSION <Session>

SESSION specifies the id of the session to close. This option will resolve variables.

Security

This command requires trust level 3 or higher for the session owner or requires trust level 5 for non-session owners.

Results

If successful, the result buffer will be empty.

Examples

Goal: Close session with id 12.

CLOSE SESSION 12

LIST SESSIONS

This command will list all the sessions that are currently open.

Syntax

LIST    SESSIONS

SESSIONS specifies to list the sessions that are currently open.

Security

This command requires trust level 2 or higher.

Results

If successful, the result buffer will contain a list of the sessions that are currently open. Each line in the session list will contain output in the following format:

<Session Id>;<Url>;<Page Title>

For example:

1;http://ais.austin.ibm.com/content/Other/test/testHttp.html;HTTP Service Test
2;http://staf.sourceforge.net/;Software Testing Automation Framework (STAF)

Examples

Goal: List all sessions.

LIST SESSIONS

QUERY SESSION

This command returns information regarding a session.

Syntax

QUERY   SESSION <Session>

SESSION specifies the id of the session to be queried. This option will resolve variables.

Security

This command requires trust level 2 or higher.

Results

If successful, the result buffer will contain the output in the following format:

Url               : <Url>
Title             : <Page Title>
Status Code       : <Status Code>
Status Message    : <Status Message>
Cookie Policy     : <Cookie Policy>
Follows Redirects : <Enabled | Disabled>
Owner Machine     : <Owner Machine>
Owner Process Name: <Owner Process Name>
Owner Handle      : <Owner Handle>

For example:

Url               : http://staf.sourceforge.net/
Title             : Software Testing Automation Framework (STAF)
Status Code       : 200
Status Message    : OK
Cookie Policy     : rfc2109
Follows Redirects : Disabled
Owner Machine     : machA.austin.ibm.com
Owner Process Name: STAX/Job/1
Owner Handle      : 15

Examples

Goal: Check the status of session with id 2.

QUERY SESSION 2

GET SESSION CONTENT

This command returns the content from the last http request or redirection. It does not show any changes made to forms in the page through the use of the FORM commands. This is the content that is visible in the browser.

Syntax

GET     SESSION <Session> CONTENT [FILE <File Name> [TOMACHINE <Machine>]]

SESSION specifies the id of the session. This option will resolve variables.

CONTENT specifies to get the content from the last http request or redirection.

FILE specifies the name of a file where the response should be stored. If the FILE option is not specified, the response will be returned in the STAF result buffer. If an error occurs writing to the file, an error will be generated and the response will be returned in the result buffer. This option will resolve variables.

TOMACHINE specifies the machine where the output file should be stored. This option will resolve variables.

Security

This command requires trust level 3 or higher.

Also, if option TOMACHINE is specified, the HTTP service machine requires trust level 4 on the target machine in order to copy the file from the HTTP service machine to the target machine.

Results

If successful, the result buffer will contain the response body of the last request or redirection.

Examples

Goal: Get the current contents of a session (3).

GET CONTENT SESSION 3

Goal: Store the current contents of a session (3) in a file (c:/temp.html).

GET CONTENT SESSION 3 FILE c:/temp.html

Goal: Store the current contents of a session (1) in a file (/tmp/theContent.html) on machine machine1.austin.ibm.com.

GET CONTENT SESSION 1 FILE /tmp/theContent.html TOMACHINE machine1.austin.ibm.com

SET SESSION

This command sets the default behavior for following redirects for a session. A possible redirect occurs when an HTTP return code of 3XX is encountered. When following redirects is enabled, the HTTP service will follow up to 100 redirects, after that point it is assumed that an inadvertant infinite loop has been entered and return an error.

Syntax

SET     <FOLLOWREDIRECT | DONOTFOLLOWREDIRECT> SESSION <Session>

FOLLOWREDIRECT specifies the session should attempt to follow any 3XX return codes it gets from attempting the request. The contents of the result buffer will contain the result of the last redirect followed.

DONOTFOLLOWREDIRECT specifies the session should not attempt to follow any 3XX return codes it gets from attempting the request.

SESSION specifies the id of the session. This option will resolve variables.

Security

This command requires trust level 3 or higher for the session owner or requires trust level 4 for non-session owners.

Results

If successful, the result buffer will be empty.

Examples

Goal: Store the default behavior of session 3 to follow redirects.

SET FOLLOWREDIRECT SESSION 3

Goal: Store the default behavior of session 3 to not follow redirects.

SET DONOTFOLLOWREDIRECT SESSION 3

Request Management

REQUEST

Generates and sends an HTTP request. Then returns the HTTP response in a variety of formats.

Syntax

REQUEST METHOD <Http Method> URL <Target Url> [CONTENT <Content>]
        [HEADER <Key>=<Value>]... [PARAMETER <Key>=<Value>]...
        [CONTENTFILE <Key>=<File Name>]...
        [FOLLOWREDIRECT | DONOTFOLLOWREDIRECT] [SESSION <Session>]
        [FILE <Filename> [TOMACHINE <Machine>]]
        [IGNOREERRORS] [NOSTATUS] [RETURNHEADERS] [RETURNNOCONTENT]

METHOD specifies the HTTP method to be used in this request. This may be any of GET, POST, PUT, HEAD, OPTIONS, DELETE, or TRACE. This option will resolve variables.

URL specifies the host, port, and uri which should be used as the URL for this HTTP request. This should be of the format:

 [protocol://][host][:port]/uri
The supported protocols are http and https. Note that http is the default if protocol is not specified. This option will resolve variables.

CONTENT specifies the content-body which should be sent with this request. This parameter will be ignored for GET, HEAD, OPTIONS, DELETE, or TRACE methods. This parameter is optional. This option will resolve variables.

HEADER may be specified to include HTTP Headers in the request. The headers should be specified as key value pairs in the form key=value. This parameter is optional. This parameter may be specified more than once to set multiple headers. This option will resolve variables.

The following headers will be set by default:
User-Agent: Jakarta Commons-HttpClient/3.0-rc2
Host: host_url
The following headers will be set if content was specified and the method is either PUT or POST:
Content-type: application/x-www-form-urlencoded
Content-length: <length>
All of these headers may be overridden by specifying different values.

PARAMETER may be specified to include parameters in a request. The parameters should be specified as key value pairs in the form Parameter Name=Value. This option may be specified more than once to set multiple parameters. Only GET and POST requests can specify parameters. If this option is specified, CONTENT is ignored. This option will resolve variables.

CONTENTFILE may be specified to include files in a request. The parameters should be specified as key value pairs in the form Parameter Name=File Name. This option may be specified more than once to set multiple files. Only POST requests can specify parameters. If this option is specified the service will attempt a multipart post using a binary file transfer. If this option is specified CONTENT is ignored. This option will resolve variables.

SESSION specifies the id of the session to perform the request on. This option will resolve variables.

FOLLOWREDIRECT specifies the session should attempt to follow any 3XX return codes it gets from attempting the request. This is a recursive process and will follow up to 100 redirects. This option will override the session setting. The contents of the result buffer will contain the result of the last redirect followed.

DONOTFOLLOWREDIRECT specifies the session should not attempt to follow any 3XX return codes it gets from attempting the request. This option will override the session setting.

FILE specifies a file which should be used to store the response. If the FILE parameter is not specified the response will be returned in the STAF result buffer. If an error occurs writing to the file an error will be generated and the response will be returned in the result buffer. This option will resolve variables.

TOMACHINE specifies the machine that should be used to store the outputfile. This option will resolve variables.

IGNOREERRORS may be specified to indicate that HTTP client and server errors (HTTP status codes of 4XX and 5XX) should be ignored. The default is to return a non-zero STAF return code when an HTTP error is encountered. If this option is specified and an error occurs, the command will return a 0 code. However, the status code will still be returned, unless disabled. See the Return Codes section below for more information.

NOSTATUS may be specified to indicate that the HTTP response code and HTTP response message should not be returned in the result. Default is to include both of these values in the output.

RETURNHEADERS may be specified to indicate that all HTTP headers in the HTTP response should be returned with the result. Default is to not include headers in the output.

RETURNNOCONTENT may be specified to indicate that the HTTP response body should not be returned in the result. Default is to include it in the output.

Security

if option SESSION is not specified, this command requires trust level 3 or higher.

If option SESSION is specified, this command requires trust level 3 or higher for the session owner or requires trust level 4 for non-session owners.

Also, if option TOMACHINE is specified, the HTTP service machine requires trust level 4 on the target machine in order to copy the file from the HTTP service machine to the target machine.

Return Codes

If an HTTP Client or Server error occurs (HTTP Status code of 4XX or 5XX) and IGNOREERRORS was not specified, then the STAF return code will be 4000 plus the HTTP status code. For example, if the response had a status code of 501 the STAF return code would be 4501. All other return codes from REQUEST are documented in "HTTP Error Code Reference".

Results

If successful, the result buffer will contain the output of the HTTP response upon completion. The format of this output is:

<HTTP Status Code>
<HTTP Status Message (will be "null" if empty)>
<Headers>
<Content>
For example:
200
OK
User-Agent: Java1.3.0
Host: testmachine.austin.ibm.com:7765
Accept: text/html, image/gif, image/jpeg,*; q=.2, */*; q=.2
Connection: keep-alive
Content-type: application/x-www-form-urlencoded
Content-length: 58
This is the content from the response to the HTTP request.

Notes:

  1. Some of this content may be masked by specifying (or not specifying) certain parameters. See above.
  2. If the FILE parameter is specified, this information will be written to the file rather than to the result buffer.

Examples

Goal: Get the HTTP options available in a request to Amazon's website.

REQUEST METHOD options URL http://www.amazon.com RETURNHEADERS

Goal: Test a multipart post script with 3 files and 2 additional parameters on the local machine.

REQUEST METHOD post CONTENTFILE file1=c:\test.txt CONTENTFILE file2=c:\test.jpg CONTENTFILE file3=c:\test.exe PARAMETER foo=bar PARAMETER foo=goo URL http://localhost:8080/multi-file-test.pl

Goal: Test a post script with a single text file as the content body.

REQUEST METHOD post URL http://localhost:8080/text-file-test.pl HEADER content-type=text CONTENT <file contents>

Goal: Perform a trace to verify a test site is active.

REQUEST METHOD trace URL http://myTestDomain/

Goal: Login to a secure website (e.g. SourceForge) and go to a personal homepage.

REQUEST METHOD post URL http://sourceforge.net/account/login.php PARAMETER form_loginname=user PARAMETER form_pw=password PARAMETER login=Login+With+SSL SESSION 1 RETURNNOCONTENT
 
REQUEST METHOD get URL https://sourceforge.net/my/ RETURNNOCONTENT

DOPOST

A DOPOST command is identical to a REQUEST command, except that the method is assumed to be POST.

DOGET

A DOGET command is identical to a REQUEST command, except that the method is assumed to be GET and CONTENTFILES is not allowed. 


Preemptive Authentication Management

LIST AUTHENTICATIONHOSTS

This command lists all the authentication hosts in the current page of the specified session. When directed to a secure site that exists on a host in the authentication hosts list, the HTTP service will preemptively attempt to authenticate a secure session with the site using the user and password associated with the host. The HTTP service supports Basic, Digest, and NTLM authentication schemes.

Syntax

LIST    AUTHENTICATIONHOSTS SESSION <Session>

AUTHENTICATIONHOSTS specifies to list all the authentication hosts in the current page of the specified session.

SESSION specifies the id of the session with the authentication enabled hosts. This option will resolve variables.

Security

This command requires trust level 2 or higher.

Results

If successful, the result buffer will contain a list of the authentication enabled hosts in the session.

For example:

www.mysite.com
www.mysite2.com

Examples

Goal: Get a list of authentication enabled hosts present in session 3.

LIST AUTHENTICATIONHOSTS SESSION 3

QUERY AUTHENTICATIONHOST

This command provides information about a specific authentication host. When directed to a secure site that exists on a host in the authentication hosts list, the HTTP service will preemptively attempt to authenticate a secure session with the site using the user and password associated with the host. The HTTP service supports Basic, Digest, and NTLM authentication schemes.

Syntax

QUERY   AUTHENTICATIONHOST <Host> SESSION <Session>

AUTHENTICATIONHOST specifies the host to get information about. This option will resolve variables.

SESSION specifies the id of the session with the authentication enabled hosts. This option will resolve variables.

Security

This command requires trust level 2 or higher.

Results

If successful, the result buffer will contain information about the specified authentication enabled host in the following format:

Host     : <Authentication Host>
User     : <User Id>
Password : <Password>
Domain   : <Domain>
If a password was specified, it will be displayed as XXXXXX.

For example:

Host     : www.mysite.com
User     : admin
Password : XXXXXX
Domain   :

Examples

Goal: Get the information about a authentication enabled host, www.mysite.com, in session 1.

QUERY AUTHENTICATIONHOST www.mysite.com SESSION 1

SET AUTHENTICATIONHOST

This command set the user and password of a authentication enabled host in the specified session. If the host is not in the authentication list, it will be added to the list. If it is in the list, the current values will be replaced.
The HTTP service supports Basic, Digest, and NTLM authentication schemes.

Warning: STAF does not encrypt its TCP communication, so the password will be sent in the clear to another STAF machine.

Syntax

SET     AUTHENTICATIONHOST <Host> AUTHENTICATIONUSER <User>
        [AUTHENTICATIONPASSWORD <Password>] [AUTHENTICATIONDOMAIN <Domain>] 
        SESSION <Session>

AUTHENTICATIONHOST specifies the host to be manipulated. This option will resolve variables.

AUTHENTICATIONUSER specifies the user to be associated with the host. This option will resolve variables.

AUTHENTICATIONPASSWORD specifies the password to be associated with the host. This option will resolve variables.

AUTHENTICATIONDOMAIN specifies the domain to be associated with the host. This is only used for NTLM authentication. This option will resolve variables.

SESSION specifies the id of the session with the authentication enabled host. This option will resolve variables.

Security

This command requires trust level 3 or higher for the session owner or requires trust level 4 for non-session owners.

Results

If successful, the result buffer will be empty.

Examples

Goal: Set the values of the authentication enabled host www.mysite.com in session 3 to user Bob and password myCat.

SET AUTHENTICATIONHOST www.mysite.com AUTHENTICATIONUSER Bob AUTHENTICATIONPASSWORD myCat SESSION 3

Goal: Add a new authentication enabled host www.mysite.com in session 1 with user admin and no password.

SET AUTHENTICATIONHOST www.mysite.com AUTHENTICATIONUSER admin SESSION 1

DELETE AUTHENTICATIONHOST

This command removes a authentication enabled host from the specified session

Syntax

DELETE  AUTHENTICATIONHOST <Host> SESSION <Session>

AUTHENTICATIONHOST specifies the name of the authenticated host to be removed. This option will resolve variables.

SESSION specifies the id of the session with the authentication enabled host. This option will resolve variables.

Security

This command requires trust level 3 or higher for the session owner or requires trust level 4 for non-session owners.

Results

If successful, the result buffer will be empty.

Examples

Goal: Remove the authentication enabled host, www.myhost.com from session 3

DELETE AUTHENTICATIONHOST www.myhost.com SESSION 3


Default Header Management

LIST DEFAULTHEADERS

This command lists all the default headers in the specified session

Syntax

LIST    DEFAULTHEADERS SESSION <Session>

DEFAULTHEADERS specifies to list all the default headers in the specified session.

SESSION specifies the id of the session with the default headers. This option will resolve variables.

Security

This command requires trust level 2 or higher.

Results

If successful, the result buffer will contain a list of the default headers in the session

For example:

job
user-id

Examples

Goal: Get a list of default headers present in session 3.

LIST DEFAULTHEADERS SESSION 3

QUERY DEFAULTHEADER

This command provides information about a specific default header in the specified session.

Syntax

QUERY   DEFAULTHEADER <Key> SESSION <Session>

DEFAULTHEADER specifies the key of the default header about which to get information. This option will resolve variables.

SESSION specifies the id of the session with the default header. This option will resolve variables.

Security

This command requires trust level 2 or higher.

Results

If successful, the result buffer will contain information about the specified default header in the following format:

Key   : <Key>
Value : <Value>
For example:
Key   : user-id
Value : Bob

Examples

Goal: Get the information about a default header with key user-id in session 3.

QUERY DEFAULTHEADER user-id SESSION 3

SET DEFAULTHEADER

This command sets the value of a default header in the specified session. If the specified default header does not exist, a new default header will be created and added to the session. If the default header does exist, the current value will be overwritten

Syntax

SET     DEFAULTHEADER <Key> VALUE <Value> SESSION <Session>

DEFAULTHEADER specifies the key of the default header to be manipulated. This option will resolve variables.

VALUE specifies that the new value of the default header. This option will resolve variables.

SESSION specifies the id of the session with the default header. This option will resolve variables.

Security

This command requires trust level 3 or higher for the session owner or requires trust level 4 for non-session owners.

Results

If successful, the result buffer will be empty.

Examples

Goal: Set the value of the default header with key user-id in session 3 to tester.

SET DEFAULTHEADER user-id VALUE tester SESSION 3

Goal: Add a new default header with key job with a value of test to session 3.

SET DEFAULTHEADER job VALUE test SESSION 3

DELETE DEFAULTHEADER

This command removes a default headers from the specified session

Syntax

DELETE  DEFAULTHEADER <Key> SESSION <Session>

DEFAULTHEADER specifies the name of the default header to be removed. This option will resolve variables.

SESSION specifies the id of the session with the default header. This option will resolve variables.

Security

This command requires trust level 3 or higher for the session owner or requires trust level 4 for non-session owners.

Results

If successful, the result buffer will be empty.

Examples

Goal: Remove the default header with key job from session 3

DELETE DEFAULTHEADER job SESSION 3


Cookie Management

LIST COOKIES

This command lists all cookies in the specified session

Syntax

LIST    COOKIES SESSION <Session>

COOKIES specifies to list all cookies in the specified session.

SESSION specifies the id of the session with the cookies. This option will resolve variables.

Security

This command requires trust level 2 or higher.

Results

If successful, the result buffer will contain a list of the cookies in the session. For example:

session-id-time
session-id
obidos_path_continue-shopping
ubid-main

Examples

Goal: Get a list of cookies present in session 3.

LIST COOKIES SESSION 3

QUERY COOKIE

This command provides information about a specific cookie.

Syntax

QUERY   COOKIE NAME <Name> SESSION <Session>

COOKIE specifies to query a cookie.

NAME specifies the name of the cookie to be manipulated. This option will resolve variables.

SESSION specifies the id of the session with the cookie. This option will resolve variables.

Security

This command requires trust level 2 or higher.

Results

If successful, the result buffer will contain information about the specified cookie in the following format

Name           : <Cookie Name>
Value          : <Cookie Value>
Domain         : <Domain>
Path           : <Path>
Expiration Date: <Expiration Date>
For example:
Name           : session-id
Value          : 104-4977587-2732748
Domain         : .amazon.com
Path           : /
Expiration Date: Fri Aug 27 03:00:00 CDT 2004

Examples

Goal: Get the information about a cookie named session-id in session 1.

QUERY COOKIE NAME session-id SESSION 1

SET COOKIE

This command sets the value of a cookie in the specified session

Syntax

SET     COOKIE <NAME <Name> VALUE <Value>> | <POLICY <policy>>
        SESSION <Session>
COOKIE specifies to set the value of a cookie.

NAME specifies the name of the cookie to be manipulated. This option will resolve variables.

VALUE specifies that the new value of the cookie. If the named cookie does not exist, a new cookie will be created and added to the session. This option will resolve variables.

POLICY specifies a new cookie policy for the session. Valid policy's are NETSCAPE, RFC2109, COMPATIBILITY, and IGNORE. The specification of any other policy will invoke HttpClient's default cookie policy, RFC2109. For more information on cookie policies see Http Client cookie information. This option will resolve variables.

SESSION specifies the id of the session with the cookie. This option will resolve variables.

Security

This command requires trust level 3 or higher for the session owner or requires trust level 4 for non-session owners.

Results

If successful, the result buffer will be empty.

Examples

Goal: Set the cookie handling policy to follow netscape's guidelines.

SET COOKIE SESSION 3 POLICY Netscape

Goal: Set the value of the cookie named user-id in session 3 to tester.

SET COOKIE SESSION 3 NAME user-id VALUE tester

Goal: Add a new cookie named job with a value of test to session 3.

SET COOKIE SESSION 3 NAME job VALUE test

DELETE COOKIE

This command removes a cookie from the specified session

Syntax

DELETE  COOKIE NAME <Name> SESSION <Session>
COOKIE specifies to remove a cookie.

NAME specifies the name of the cookie to be manipulated. This option will resolve variables.

SESSION specifies the id of the session with the cookie. This option will resolve variables.

Security

This command requires trust level 3 or higher for the session owner or requires trust level 4 for non-session owners.

Results

If successful, the result buffer will be empty.

Examples

Goal: Remove the cookie named job from session 3

DELETE COOKIE SESSION 3 NAME job


Form Management

LIST FORMS

This command provides a list of the form elements in the current page of the specified session.

Syntax

LIST    FORMS SESSION <Session>
FORMS specifies to list all the form elements in the current page of the specified session.

SESSION specifies the id of the session containing the form. This option will resolve variables.

Security

This command requires trust level 2 or higher.

Results

If successful, the result buffer will contain a list of the forms in the specified page. The list contains the index of the form, the Id attribute for each form (if it has one), and the name attribute of the form (if it has one). Each line in the list of forms for the specified page will have the following format:

<Form Index>;<Form Id>;<Form Name>
For example,
1;GET_FORM;The Get Form
2;POST_FORM;The Post Form
3;POST_FORM_2;

Examples

Goal: Get a list of forms in session 3

LIST FORMS SESSION 3

LIST FORM CONTROLNAMES

This command provides a list of the form control elements of the specified form in the current page of the specified session.

Syntax

LIST    CONTROLNAMES FORM [NAME <Form Name> | ID <Id> | INDEX <Index>] SESSION <Session Id>
CONTROLNAMES specifies to list the names of the form control elements of the specified form.

FORM specifies to list form control elements.

NAME identifies the name attribute to use to specify the form. If more than one form has the same name, the first form with the specified name will be selected. This option will resolve variables.

ID identifies the id attribute to use to specify the form. If more than one form has the same name, the first form with the specified id attribute will be selected. This option will resolve variables.

INDEX identifies the index of the form to be selected in the list of forms in the current page. This is a 1-based index. If no form is identified, the form at index 1 is selected. This option will resolve variables.

SESSION specifies the id of the session containing the form. This option will resolve variables.

If neither NAME, ID, or INDEX is specified, it defaults to the first form.

Security

This command requires trust level 2 or higher.

Results

If successful, the result buffer will contain a list of the form control elements of the specified form in the specified page. Each line in the list will have the following format:

<Form Control Name>
For example:
submit
town

Examples

Goal: Get a list of form controls in the first form in session 3

LIST CONTROLNAMES FORM INDEX 1 SESSION 3

or

LIST CONTROLNAMES FORM SESSION 3

Goal: Get a list of form controls in the form whose id is GET_FORM in session 1

LIST CONTROLNAMES FORM ID GET_FORM SESSION 1

Goal: Get a list of form controls in the form whose name attribute is "The Get Form" in session 2

LIST CONTROLNAMES FORM NAME "The Get Form" SESSION 2

QUERY FORM

This command provides information about the specified form in the current page of the specified session.

Syntax

QUERY   FORM [NAME <Form Name> | ID <Id> | INDEX <Index>] [CONTROLNAME <Name>]
        SESSION <Session>
FORM specifies to query a form in current page of the specified session.

NAME identifies the name attribute to use to specify the form. If more than one form has the same name, the first form will be selected. This option will resolve variables.

ID identifies the id attribute to use to specify the form. If more than one form has the same name, the first form will be selected. This option will resolve variables.

INDEX identifies the index of the form to be selected in the list of forms in the current page. This is a 1-based index. If no form is identified, the form at index 1 is selected. This option will resolve variables.

CONTROLNAME identifies the form control to provide information about instead of the form in general. This option will resolve variables.

SESSION specifies the id of the session containing the form. This option will resolve variables.

Security

This command requires trust level 2 or higher.

Results

If successful, the result buffer will contain information about the specified form based on the options specified.

If the CONTROLNAME option is not specified, the result will be in the following format:

Index          : <Form Index>
Name           : <Form Name>
Id             : <Form Id>
Method         : <Form Method>
Action         : <Form Target Url>
For example:
Index          : 2
Name           : The Post Form
Id             : POST_FORM
Method         : Post
Action         : http://www.htmlcodetutorial.com/cgi-bin/mycgi.pl

If the CONTROLNAME option is specified, the result buffer will contain information about the specified form control name in the following format:

Name             : <Form Control Name>
Type             : <Type>
Disabled         : <Yes | No | blank if not selected>
Read Only        : <Yes | No | blank if not selected>
Value            : <Selected Form Control Value>
Possible Value n : <Possible Value n>
Note: The "Possible Value n" line may appear zero or more times with n replaced with a number beginning with 1. These lines show other possible values that may be specified for this form control.

Here are some examples of possible results from querying a form control name:

Name             : myself
Type             : textarea
Disabled         : No
Read Only        : No
Value            : I was born in the house my father built. 
Name             : animal
Type             : input type=radio
Disabled         : No
Read Only        : No
Value            : dog
Possible Value 1 : cat
Possible Value 2 : bird
Name             : nosmoke=
Type             : input type=checkbox
Disabled         : No
Read Only        : No
Value            : CHECKED
Name             : realname
Type             : input type=text
Disabled         : No
Read Only        : No
Value            : George the Wonder Boy
Name             : submit
Type             : Submit group
Disabled         : No
Read Only        : No
Value            : GO=go
Possible Value 1 : GO=go
Possible Value 2 : Stay=stay
Possible Value 3 : roll over=Roll Over
Possible Value 4 : pic=,<valueX>,<valueY>
Name             : who
Type             : select
Disabled         : No
Read Only        : No
Value            :
Possible Value 1 : foo
Possible Value 2 : sam
Name             : who1
Type             : select multiple
Disabled         : No
Read Only        : No
Value            : foo
sam
Name             : null
Type             : null type
Disabled         : null
Read Only        : null
Value            : 

Examples

Goal: Get information about the form named "The Post Form" in session 3.

QUERY FORM NAME "The Post Form" SESSION 3

Goal: Get information about the first form in session 1.

QUERY FORM SESSION 2

Goal: Get information about the second form in session 1.

QUERY FORM INDEX 2 SESSION 1

Goal: Get information about the form with id POST_FORM in session 3.

QUERY FORM ID POST_FORM SESSION 3

Goal: Get information about the form control named "animal" for the third form in session 1.

QUERY FORM INDEX 3 CONTROLNAME animal SESSION 1

SET FORM

This command provides access to the form control elements in the current page of the specified session.

Syntax

SET     FORM [NAME <Form Name> | ID <Id> | INDEX <Index>]
        CONTROLNAME <Name> VALUE <Value> SESSION <Session>
FORM specifies to set a form control name.

NAME identifies the name attribute to use to specify the form. If more than one form has the same name, the first form will be selected. This option will resolve variables.

ID identifies the id attribute to use to specify the form. If more than one form has the same name, the first form will be selected. This option will resolve variables.

INDEX identifies the index of the form to be selected in the list of forms in the current page. This is a 1-based index. If no form is identified, the form at index 1 is selected. This option will resolve variables.

CONTROLNAME specifies the form control to set. In most cases, this is the name attribute of the control element. The exception is input elements of type checkbox, submit, and image. See Appendix A: Form Control Guide for more information. This option will resolve variables.

VALUE specifies the new value for the form control. See Appendix A: Form Control Guide for more information. This option will resolve variables.

SESSION specifies the id of the session containing the form. This option will resolve variables.

Security

This command requires trust level 3 or higher for the session owner or requires trust level 4 for non-session owners.

Results

If successful, the result buffer will be empty.

Examples

Goal: Set the input element named user to the value me for the form named Form_1 in session 3.

SET FORM NAME Form_1 SESSION 3 CONTROLNAME user VALUE me

For more examples of setting control values for forms, see Appendix A: Form Control Guide.

SUBMIT FORM

This command submits a form from the current page in the specified session.

Syntax

SUBMIT  FORM [NAME <Form Name> | ID <Id> | INDEX <Index>] SESSION <Session>
        [FOLLOWREDIRECT | DONOTFOLLOWREDIRECT]
        [FILE <Filename> [TOMACHINE <Machine>]]
        [IGNOREERRORS] [NOSTATUS] [RETURNHEADERS] [RETURNNOCONTENT]
FORM specifies to submit form from the current page in the specifies session.

NAME identifies the name attribute to use to specify the form. If more than one form has the same name, the first form will be selected. This option will resolve variables.

ID identifies the id attribute to use to specify the form. If more than one form has the same name, the first form will be selected. This option will resolve variables.

INDEX identifies the index of the form to be selected in the list of forms in the current page. This is a 1-based index. If no form is identified, the form at index 1 is selected. This option will resolve variables.

SESSION specifies the id of the session containing the form. This option will resolve variables.

FOLLOWREDIRECT specifies the session should attempt to follow any 3XX return codes it gets from attempting the request. This is a recursive process and will follow up to 100 redirects. This option will override the session setting. The contents of the result buffer will contain the result of the last redirect followed.

DONOTFOLLOWREDIRECT specifies the session should not attempt to follow any 3XX return codes it gets from attempting the request. This option will override the session setting.

FILE specifies the name of a file where the response should be stored. If the FILE option is not specified, the response will be returned in the STAF result buffer. If an error occurs writing to the file, an error will be generated and the response will be returned in the result buffer. This option will resolve variables.

TOMACHINE specifies the machine where the output file should be stored. This option will resolve variables.

IGNOREERRORS specifies that HTTP client and server errors (HTTP status codes of 4XX and 5XX) should be ignored. The default is to return a non-zero STAF return code when an HTTP error is encountered. If this option is specified and an error occurs, the command will return a 0 code. However, the status code will still be returned, unless disabled. See the Return Codes section of the REQUEST command for more information.

NOSTATUS specifies that the HTTP response code and HTTP response message should not be returned in the result. The default is to include both of these values in the output.

RETURNHEADERS specifies that all HTTP headers in the HTTP response should be returned with the result. The default is to not include headers in the output.

RETURNNOCONTENT specifies that the HTTP response body should not be returned in the result. The default is to include it in the output.

Security

This command requires trust level 3 or higher for the session owner or requires trust level 4 for non-session owners.

Also, if option TOMACHINE is specified, the HTTP service machine requires trust level 4 on the target machine in order to copy the file from the HTTP service machine to the target machine.

Results

If successful, the result buffer will contain the output of the HTTP response. The format of this output is described in the Results section for the REQUEST command.

Examples

Goal: Submit Form_1 in session 3 using the submit button with name Go and value GO.

SET FORM SESSION 3 NAME Form_1 CONTROLNAME submit VALUE Go=GO
SUBMIT FORM SESSION 3 NAME Form_1

RESET FORM

This command provides a way to reset the contents of a form in the current page of the specified session.

Syntax

RESET   FORM [NAME <Form Name> | ID <Id> | INDEX <Index>] SESSION <Session>
FORM specifies to reset the contents of a form.

NAME identifies the name attribute to use to specify the form. If more than one form has the same name, the first form will be selected. This option will resolve variables.

ID identifies the id attribute to use to specify the form. If more than one form has the same name, the first form will be selected. This option will resolve variables.

INDEX identifies the index of the form to be selected in the list of forms in the current page. This is a 1-based index. If no form is identified, the form at index 1 is selected. This option will resolve variables.

SESSION specifies the id of the session containing the form. This option will resolve variables.

Security

This command requires trust level 3 or higher for the session owner or requires trust level 4 for non-session owners.

Results

If successful, the result buffer will be empty.

Examples

Goal: Reset the control values for the form named Form_1 in session 3.

RESET FORM SESSION 3 NAME Form_1


Link Management

LIST LINKS

This command provides a list of the links elements in the current page of the specified session.

Syntax

LIST    LINKS SESSION <Session>

LINKS specifies to list the link elements on the current page of the specified session.

SESSION specifies the session id. This option will resolve variables.

Security

This command requires trust level 2 or higher.

Results

If successful, the result buffer will contain a list of the links in the current page of the specified session. Each line in the list will contain the index of the link, the link's id attribute (if one exists), and the link's name attribute (if one exists) as follows:

<Link Index>;<Link Id>;<Link Name>
For example:
1;tamu;
2;chi;CHI
3;csdl;

Examples

Goal: Get a list of links in session 3

LIST LINKS SESSION 3

QUERY LINK

This command provides information about the specified link in the current page of the specified session.

Syntax

QUERY   LINK <NAME <Name> | ID <Id> | INDEX <Index>> SESSION <Session>

LINK specifies to query information about a link.

NAME specifies the name attribute of the link to follow in the current page. If more than one link has the same name, the first name will be selected. This option will resolve variables.

ID specifies the id attribute of the link to follow in the current page. This option will resolve variables.

INDEX specifies the index of the link to follow in the currenbt page. This is a 1-based index. This option will resolve variables.

SESSION specifies the session id. This option will resolve variables.

Security

This command requires trust level 2 or higher.

Results

If successful, the result buffer will information about the form in the following format:

Index : <Link Index>
Name  : <Link Name>
Id    : <Link Id>
Href  : <Form target url>
For example:
Index : 1
Name  : test
Id    : LINK_2
Href  : http://www.htmlcodeturorial.com/

Examples

Goal: Get information about the link with id Link_1 in the current page for session 2.

QUERY LINK ID Link_1 SESSION 2

Goal: Get information about the first link in the current page for session 3.

QUERY LINK INDEX 1 SESSION 3

Goal: Get information about the link with name attribute "My Link" in session 3.

QUERY LINK NAME "My Link" SESSION 3

FOLLOW LINK

This command changes the url of a session. It is equivalent to issuing a DOGET command with the URL value set to the href of the link.

Syntax

FOLLOW  LINK <NAME <Name> | ID <Id> | INDEX <Index>> SESSION <Session>
        [FOLLOWREDIRECT | DONOTFOLLOWREDIRECT]
        [FILE <Filename> [TOMACHINE <Machine>]]
        [IGNOREERRORS] [NOSTATUS] [RETURNHEADERS] [RETURNNOCONTENT]

LINK specifies to follow a link in the current page of the specified session.

NAME specifies the name attribute of the link to follow. If more than one link has the same name, the first name will be selected. This option will resolve variables.

ID specifies the id attribute of the link to follow. This option will resolve variables.

INDEX specifies the index of the link to follow. This is a 1-based index. This option will resolve variables.

SESSION specifies the id of the session. This option will resolve variables.

FOLLOWREDIRECT specifies the session should attempt to follow any 3XX return codes it gets from attempting the request. This is a recursive process and will follow up to 100 redirects. This option will override the session setting. The contents of the result buffer will contain the result of the last redirect followed.

DONOTFOLLOWREDIRECT specifies the session should not attempt to follow any 3XX return codes it gets from attempting the request. This option will override the session setting.

FILE specifies the name of a file where the response will be stored. If the FILE option is not specified, the response will be returned in the result buffer. If an error occurs writing to the file, an error will be generated and the response will be returned in the result buffer. This option will resolve variables.

TOMACHINE specifies the machine where the output file will be stored. This option will resolve variables.

IGNOREERRORS specifies that HTTP client and server errors (HTTP status codes of 4XX and 5XX) should be ignored. The default is to return a non-zero STAF return code when an HTTP error is encountered. If this option is specified and an error occurs, the command will return a 0 code. However, the status code will still be returned, unless disabled. See the Return Codes section of the REQUEST command for more information.

NOSTATUS specifies that the HTTP response code and HTTP response message should not be returned in the result. The default is to include both of these values in the output.

RETURNHEADERS specifies that all HTTP headers in the HTTP response should be returned with the result. The default is to not include headers in the output.

RETURNNOCONTENT specifies that the HTTP response body should not be returned in the result. The default is to include it in the output.

Security

This command requires trust level 3 or higher for the session owner or requires trust level 4 for non-session owners.

Also, if option TOMACHINE is specified, the HTTP service machine requires trust level 4 on the target machine in order to copy the file from the HTTP service machine to the target machine.

Results

If successful, the result buffer will contain the output of the HTTP response. The format of this output is described in the Results section for the REQUEST command.

Examples

Goal: Follow the link with id Link_1 in session 3.

FOLLOW LINK SESSION 3 ID Link_1


Session Examples

This section provides several examples of how the session functionality of the HTTP service can be leveraged.

The examples provided are submitting requests to the HTTP service from the command line, but the requests can also be submitted via a program (e.g. a shell script, Java program, etc).

Example 1: SSL Login Using Cookie Authentication and a Form

Demonstrates a SSL login using cookie authentication, and the use of a form to gather web based information. This example logs into the SourceForge website, so to run this example, you need a SourceForge user id.

  1. Open a new session:
    C:\>STAF local HTTP OPEN SESSION
    Response
    --------
    1
    

  2. Enable automatic redirection:
    C:\>STAF local HTTP SET FOLLOWREDIRECT SESSION 1
    Response
    --------
    
    

  3. Login to SourceForge (replace the value for the form_loginname parameter with your userid and replace the value for the form_pw parameter with your password):

    C:\>STAF local HTTP DOPOST URL http://sourceforge.net/account/login.php PARAMETER form_loginname=user PARAMETER form_pw=password PARAMETER login=Login+With+SSL SESSION 1 RETURNNOCONTENT
    Response
    --------
    200
    OK

  4. Go to the STAF project webpage on SourceForge:

    C:\>STAF local HTTP DOGET URL http://sourceforge.net/projects/staf SESSION 1 RETURNNOCONTENT
    Response
    --------
    200
    OK

  5. Get a list of pending bugs:

    C:\>STAF local HTTP DOGET URL ../tracker/ PARAMETER group_id=33142 PARAMETER atid=407381 RETURNNOCONTENT SESSION 1
    Response
    --------
    200
    OK

    Note: The group_id and atid parameters used in this request can be obtained by going to the bug tracker for the STAF project. These parameters are used by SourceForge to index into the database and pull up the relevant entries to put in the displayed table.

  6. List the forms on this page and list the form controls for the form named "tracker_browse":
    C:\>STAF local HTTP LIST FORMS SESSION 1
    Response
    --------
    1;;
    2;;
    3;;tracker_browse
    4;;artifactlist
    
    
    C:\>STAF local HTTP LIST FORM NAME tracker_browse CONTROLNAMES SESSION 1
    Response
    --------
    submit
    group_id
    atid
    set
    _assigned_to
    _status
    _category
    _group
    by_submitter
    summary_keyword
    order
    sort
    

  7. Query the form controls named "_status", "sort", and "order" for the form named tracer_browse and look at their values.
    C:\>STAF local HTTP QUERY FORM NAME tracker_browse CONTROLNAME _status SESSION 1
    Response
    --------
    Name             : _status
    Type             : select
    Disabled         :
    Read Only        :
    Value            : 1
    
    
    C:\>STAF local HTTP QUERY FORM NAME tracker_browse CONTROLNAME sort SESSION 1
    Response
    --------
    Name             : sort
    Type             : select
    Disabled         :
    Read Only        :
    Value            : DESC
    
    
    C:\>STAF local HTTP QUERY FORM NAME tracker_browse CONTROLNAME order SESSION 1
    Response
    --------
    Name             : order
    Type             : select
    Disabled         :
    Read Only        :
    Value            : artifact_id
    

  8. De-select old values for the form controls named "_status", "sort", and "order":
    C:\>STAF local HTTP SET FORM NAME tracker_browse CONTROLNAME _status VALUE 1 SESSION 1
    Response
    --------
    
    
    C:\>STAF local HTTP SET FORM NAME tracker_browse CONTROLNAME sort VALUE DESC SESSION 1
    Response
    --------
    
    
    C:\>STAF local HTTP SET FORM NAME tracker_browse CONTROLNAME order VALUE artifact_id SESSION 1
    Response
    --------
    
    

  9. Select new values for the form controls named "_status", "sort", and "order":
    C:\>STAF local HTTP SET FORM NAME tracker_browse CONTROLNAME _status VALUE 4 SESSION 1
    Response
    --------
    
    
    C:\>STAF local HTTP SET FORM NAME tracker_browse CONTROLNAME sort VALUE ASC SESSION 1
    Response
    --------
    
    
    C:\>STAF local HTTP SET FORM NAME tracker_browse CONTROLNAME order VALUE open_date SESSION 1
    Response
    --------
    
    

  10. Verify the values for the form controls have been set:
    C:\>STAF local HTTP QUERY FORM NAME tracker_browse CONTROLNAME _status SESSION 1
    
    Response
    --------
    Name             : _status
    Type             : select
    Disabled         :
    Read Only        :
    Value            : 4
    
    
    C:\>STAF local HTTP QUERY FORM NAME tracker_browse CONTROLNAME sort SESSION 1
    Response
    --------
    Name             : sort
    Type             : select
    Disabled         :
    Read Only        :
    Value            : ASC
    
    
    C:\>STAF local HTTP QUERY FORM NAME tracker_browse CONTROLNAME order SESSION 1
    Response
    --------
    Name             : order
    Type             : select
    Disabled         :
    Read Only        :
    Value            : open_date
    

  11. Submit the form and store the results in a file:
    C:\>STAF local HTTP SUBMIT FORM NAME tracker_browse SESSION 1 FILE C:\bugs.html NOSTATUS
    Response
    --------
    
    This should be an html file equivalent to acquiring the page in a browser.

  12. Close the session:
    C:\>STAF local HTTP CLOSE SESSION 1
    Response
    --------
    
    

Example 2: Cookie Manipulation

This example demonstrates cookie manipulation.

  1. Open a new session:
    C:\>STAF local HTTP OPEN SESSION
    Response
    --------
    1
    

  2. Use Amazon's website to show cookie behavior. Amazon's homepage is permanently redirected, and the cookies are set at two points along the redirect.
    C:\>STAF local HTTP SET FOLLOWREDIRECT SESSION 1
    Response
    --------
    
    
    C:\>STAF local HTTP DOGET URL http://www.amazon.com RETURNNOCONTENT SESSION 1
    Response
    --------
    200
    OK
    
    C:\>STAF local HTTP LIST COOKIES SESSION 1
    Response
    --------
    session-id-time
    session-id
    obidos_path_continue-shopping
    ubid-main
    
    C:\>STAF local HTTP QUERY COOKIE NAME session-id SESSION 1
    Response
    --------
    Name           : session-id
    Value          : 104-4977587-2732748
    Domain         : .amazon.com
    Path           : /
    Expiration Date: Fri Aug 27 03:00:00 CDT 2004
    
    C:\>STAF local HTTP QUERY SESSION 1
    Response
    --------
    Url               : http://www.amazon.com/exec/obidos/subst/home/home.html/104-4
    977587-2732748
    Title             :
    Amazon.com: Welcome
    
    Status Code       : 200
    Status Message    : OK
    Cookie Policy     : rfc2109
    Follows Redirects : Enabled
    Owner Machine     : machA.austin.ibm.com
    Owner Process Name: STAF/Client
    Owner Handle      : 10
    
    The end of the url should match the value of the session-id cookie.

  3. Open another session and use Amazon's website to show another example of cookie behavior:
    C:\>STAF local HTTP QUERY COOKIE NAME session-id SESSION 1
    Response
    --------
    Name           : session-id
    Value          : 104-4977587-2732748
    Domain         : .amazon.com
    Path           : /
    Expiration Date: Fri Aug 27 03:00:00 CDT 2004
    
    C:\>STAF local HTTP QUERY SESSION 1
    Response
    --------
    Url               : http://www.amazon.com/exec/obidos/subst/home/home.html/104-4
    977587-2732748
    Title             :
    Amazon.com: Welcome
    
    Status Code       : 200
    Status Message    : OK
    Cookie Policy     : rfc2109
    Follows Redirects : Enabled
    Owner Machine     : machA.austin.ibm.com
    Owner Process Name: STAF/Client
    Owner Handle      : 10
    
    C:\>STAF local HTTP OPEN SESSION
    Response
    --------
    2
    
    C:\>STAF local HTTP SET FOLLOWREDIRECT SESSION 2
    Response
    --------
    
    
    C:\>STAF local HTTP SET COOKIE POLICY compatibility SESSION 2
    Response
    --------
    
    
    C:\>STAF local HTTP DOGET URL http://www.amazon.com RETURNNOCONTENT SESSION 2
    Response
    --------
    200
    OK
    
    C:\>STAF local HTTP LIST COOKIES SESSION 2
    Response
    --------
    obidos_path_continue-shopping
    session-id-time
    session-id
    
    
    Note the missing cookie in the list from session 2.

  4. Set a cookie value:
    C:\>STAF local HTTP SET COOKIE NAME session-id VALUE 000010001 SESSION 2
    Response
    --------
    
    

  5. Add a cookie:
    C:\>STAF local HTTP SET COOKIE NAME new_cookie VALUE new SESSION 2
    Response
    --------
    

  6. Close the sessions:
    C:\>STAF local HTTP CLOSE SESSION 1
    Response
    --------
    
    
    C:\>STAF local HTTP CLOSE SESSION 2
    Response
    --------
    
    

Example 3: Using Default Headers

This example demonstrates the use of default headers.

  1. Open a session:
    C:\>STAF local HTTP OPEN SESSION
    Response
    --------
    1
    

  2. Set a pair of headers to be sent with each request:
    C:\>STAF local HTTP SET DEFAULTHEADER myName VALUE Bob SESSION 1
    Response
    --------
    
    
    C:\>STAF local HTTP SET DEFAULTHEADER age VALUE 23 SESSION 1
    Response
    --------
    
    

  3. Verify that the Amazon web site supports TRACE:
    C:\>STAF local HTTP REQUEST METHOD options URL http://www.amazon.com RETURNHEADERS
    Response
    --------
    200
    OK
    Date: Mon, 23 Aug 2004 20:56:49 GMT
    Server: Stronghold/2.4.2 Apache/1.3.6 C2NetEU/2412 (Unix) amarewrite/0.1 mod_fastcgi/2.2.12
    Content-Length: 0
    Allow: GET, HEAD, POST, OPTIONS, TRACE
    nnCoection: close
    

  4. Check what headers are received when requests are made:
    C:\>STAF local HTTP REQUEST METHOD trace URL http://www.amazon.com SESSION 1
    Response
    --------
    200
    OK
    TRACE / HTTP/1.1
    age: 23
    Connection: Keep-Alive
    Host: www.amazon.com
    myName: Bob
    User-Agent: Jakarta Commons-HttpClient/3.0-rc2
    X-Forwarded-For: 192.35.232.241
    
    This should show that you sent a header myName: Bob and a header age: 23.

  5. Override the default headers on a request:
    C:\>STAF local HTTP REQUEST METHOD trace URL http://www.amazon.com SESSION 1 HEADER age=21
    Response
    --------
    200
    OK
    TRACE / HTTP/1.1
    age: 21
    Host: www.amazon.com
    myName: Bob
    User-Agent: Jakarta Commons-HttpClient/3.0-rc2
    X-Forwarded-For: 192.35.232.241
    
    This should show that you set a header myName: Bob and a header age: 21.

  6. Send an additional header with your request:
    C:\>STAF local HTTP REQUEST METHOD trace URL http://www.amazon.com SESSION 1 HEADER job=admin
    Response
    --------
    200
    OK
    TRACE / HTTP/1.1
    age: 23
    Connection: Keep-Alive
    Host: www.amazon.com
    job: admin
    myName: Bob
    User-Agent: Jakarta Commons-HttpClient/3.0-rc2
    X-Forwarded-For: 192.35.232.241
    
    This should show that you sent headers myName: Bob, age: 23, and job: admin. The default header values are unaffected by the previous request.

  7. Change the header age:
    C:\>STAF local HTTP SET DEFAULTHEADER age VALUE 25 SESSION 1
    Response
    --------
    
    
    C:\>STAF local HTTP REQUEST METHOD trace URL http://www.amazon.com SESSION 1
    Response
    --------
    200
    OK
    TRACE / HTTP/1.1
    age: 25
    Host: www.amazon.com
    myName: Bob
    User-Agent: Jakarta Commons-HttpClient/3.0-rc2
    X-Forwarded-For: 192.35.232.241
    
    This should show that you sent headers myName: Bob, and age: 25.

  8. Stop sending the age header:
    C:\>STAF local HTTP DELETE DEFAULTHEADER age SESSION 1
    Response
    --------
    
    
    C:\>STAF local HTTP REQUEST METHOD trace URL http://www.amazon.com SESSION 1
    Response
    --------
    200
    OK
    TRACE / HTTP/1.1
    Host: www.amazon.com
    myName: Bob
    User-Agent: Jakarta Commons-HttpClient/3.0-rc2
    X-Forwarded-For: 192.35.232.241
    
    This should show that you sent one header myName: Bob.

  9. Set myNames to be a multi-value header:
    C:\>STAF local HTTP SET DEFAULTHEADER myNames VALUE "Bob, Sam, George" SESSION 1
    Response
    --------
    
    
    C:\>STAF local HTTP REQUEST METHOD trace URL http://www.amazon.com SESSION 1
    Response
    --------
    200
    OK
    TRACE / HTTP/1.1
    Host: www.amazon.com
    myName: Bob
    myNames: Bob, Sam, George
    User-Agent: Jakarta Commons-HttpClient/3.0-rc2
    X-Forwarded-For: 192.35.232.241
    This should show that you sent one header myNames: Bob, Sam, George.

  10. Close the session:
    C:\>STAF local HTTP CLOSE SESSION 1
    Response
    --------
    
    

Example 4: Using Links

This example demonstrates the use of links.

  1. Open a session:
    C:\>STAF local HTTP OPEN SESSION
    Response
    --------
    1
    

  2. Go to your test site:

    C:\>STAF local HTTP DOGET URL ais.austin.ibm.com/content/Other/test/testHTTP.html RETURNNOCONTENT SESSION 1
    Response
    --------
    200
    OK

  3. Get a list of links on the page:
    C:\>STAF local HTTP LIST LINKS SESSION 1
    Response
    --------
    1;tamu;
    2;chi;CHI
    3;csdl;
    

  4. Check the url of one with id tamu:
    C:\>STAF local HTTP QUERY LINK ID tamu SESSION 1
    Response
    --------
    Index : 1
    Name  :
    Id    : tamu
    Href  : http://www.tamu.edu/
    

  5. Follow the link:
    C:\>STAF local HTTP FOLLOW LINK ID tamu SESSION 1 RETURNNOCONTENT
    Response
    --------
    200
    OK
    
    Verify the link went where it was supposed to go:
    C:\>STAF local HTTP QUERY SESSION 1
    Response
    --------
    Url               : http://www.tamu.edu/
    Title             : Texas A&M University - College Station
    Status Code       : 200
    Status Message    : OK
    Cookie Policy     : rfc2109
    Follows Redirects : Disabled
    Owner Machine     : lucas
    Owner Process Name: STAF/Client
    Owner Handle      : 171
    
    This has the same effect as a doget to the href of the link:
    C:\>STAF local HTTP DOGET URL http://www.tamu.edu SESSION 1
    Response
    --------
    200
    Ok
    
    Verify the link went to the same place as the FOLLOW LINK command:
    C:\>STAF local HTTP QUERY SESSION 1
    Response
    --------
    Url               : http://www.tamu.edu/
    Title             : Texas A&M University - College Station
    Status Code       : 200
    Status Message    : OK
    Cookie Policy     : rfc2109
    Follows Redirects : Disabled
    Owner Machine     : lucas
    Owner Process Name: STAF/Client
    Owner Handle      : 171
    

  6. Close the session:
    C:\>STAF local HTTP CLOSE SESSION 1
    Response
    --------
    
    

HTTP Error Code Reference

In addition to the common STAF return codes, the following HTTP return codes are defined:

Table 1. HTTP Service Return Codes

Error Code Meaning Comment
4001 Unknown Host Error The specified host could not be found in the naming service.
4002 Connect Error The host was located, but a connection could not be made to the specified port.
4003 Invalid Method The specified method is not allowed. Allowed methods: POST, PUT, GET, HEAD, OPTIONS, DELETE, and TRACE.
4004 IO Exception The host was located, but an IO exception occurred opening a connection to the URL.
44XX
45XX
HTTP Errors The Http request generated an HTTP error. The HTTP error code is the last 3 digits of the error code. See section 10 in RFC 2616 for an explanation of HTTP return codes (e.g. 404, 501, etc).


Appendix A: Form Control Guide

This section is intended to provide detailed information about interacting with the specific form control types.

For more information on HTML form controls, see the World Wide Web Consortium (W3C) website.

Getting Control Identifiers

Getting a list of control identifiers for a form is done with the LIST FORM CONTROLNAMES command. See section LIST FORM CONTROLNAMES for more information.

Getting Control Values

Getting the current value of a form control is done with the QUERY FORM CONTROLNAME command. See section QUERY FORM for more information.

Setting Control Values

Setting the value of an existing control is done using the SET FORM CONTROLNAME command. See section SET FORM for more information.

Notes:

  1. Control identifiers and values are case sensitive.

  2. Disabled controls cannot be accessed. The values of read-only controls cannot be set, but they will be sent with the submission of the form.

  3. HTTP service form controls recognize the following attributes:

Control Types

Here are some of the control types:

TEXTAREA

This control type corresponds to HTTP elements identified by <textarea> tags.

Service Request Options:

Example:

    HTML : 
      <textarea name=textarea_1>Mary had a little lamb</textarea>
    Service : 
      SET FORM form_1 CONTROLNAME textarea_1 VALUE "Mary had a little lamb."
    HTTP :
      textarea_1=Mary+had+a+little+lamb

INPUT type CHECKBOX

This control type corresponds to HTTP elements identified by <input type=checkbox> tags.

Service Request Options:

Example:

    HTML : 
      <input type=checkbox name=checkbox_1 value=check_1 checked/>
      <input type=checkbox name=checkbox_1 value=check_2 />
      <input type=checkbox name=checkbox_2 checked />
    Service : 
      SET FORM form_1 CONTROLNAME checkbox_1=check_1 VALUE checked
      SET FORM form_1 CONTROLNAME checkbox_1=check_2 VALUE unchecked
      SET FORM form_1 CONTROLNAME checkbox_2= VALUE checked
    HTTP : 
      checkbox_1=check_1&checkbox_2=

INPUT type RADIO

This control type corresponds to HTTP elements identified by <input type=radio> tags.

Service Request Options:

Example:

    HTML : 
      <input type=radio name=radio_1 value=option_1 checked/>
      <input type=radio name=radio_1 value=option_2 />
    Service : 
      SET FORM form_1 CONTROLNAME radio_1 VALUE option_1
    HTTP : 
      radio_1=option_1
Note: Only one radio control with a given name can be selected at a time.

INPUT type SUBMIT

This control type corresponds to HTTP elements identified by <input type=submit> tags.

Service Request Options:

Example:

    HTML : 
      <input type=submit name=button_1 value=do_1/>
    Service : 
      SET FORM form_1 CONTROLNAME submit VALUE button_1=do_1
    HTTP : 
      button_1=do

Notes:

  1. Only one SUBMIT or IMAGE control element may be selected at a time.
  2. The value name is restricted to controls which exist in the form when it is acquired.

INPUT type IMAGE

This control type corresponds to HTTP elements identified by <input type=img> tags.

Service Request Options:

Example:

    HTML : 
      <input type=img name=picture_1 src="./images/pic.jpg" valueX=123 valueY=80/>
    Service : 
      SET FORM form_1 CONTROLNAME submit VALUE picture_1=,123,80
    HTTP : 
      picture_1.x=123&picture_1.y=80

Notes:

  1. The value name is restricted to controls which exist in the form when it is acquired.
  2. Only one SUBMIT or IMAGE control element may be selected at a time.
  3. If the initial selection of the form submission control is of type IMAGE, the coordinates are set to <valueX>,<valueY> by default.
  4. The HTTP service does not check if the input coordinates are valid.

INPUT other types

This control type corresponds to HTTP elements identified by <input> tags with other type attributes (e.g. text, file, hidden, password)

Service Request Options:

Example:

    HTML : 
      <input type=text name=text_1 value="some text" />
      <input type=file name=file_1 value="c:\temp.gif" />
      <input type=hidden name=hidden_1 value=secret />
      <input type=password name=pwd_1 value=pwd />
    Service : 
      SET FORM form_1 CONTROLNAME text_1 VALUE "some text"
      SET FORM form_1 CONTROLNAME file_1 VALUE "c:\temp.gif"
      SET FORM form_1 CONTROLNAME hidden_1 VALUE secret
      SET FORM form_1 CONTROLNAME pwd_1 VALUE pwd
    HTTP : 
      text_1=some+text&hidden_1=secret&pwd_1=pwd
This ignores the file since that causes a multipart post which has a different format.

Notes:

  1. A bad value for an INPUT of type FILE will cause form submission to fail.
  2. The presence of an INPUT of type FILE will cause a multipart post which has a different HTTP format than the example.

An explanation of multipart/form-data can be found in the Processing form data section in hte W3C HTML Specification.

SELECT

This control type corresponds to HTTP elements identified by <select> tags.

Service Request Options:

Example:

    HTML : 
      <select name=select_1 multiple/>
        <option value=o_1>1</option>
        <option value=o_2 selected>2</option>
        <option value=o_3 selected>3</option>
      <select/>
    Service : 
      SET FORM form_1 CONTROLNAME select_1 VALUE o_2
      SET FORM form_1 CONTROLNAME select_1 VALUE o_3
    HTTP : 
      select_1=o_2&select_1=o_3

Note: It is necessary to explicitly de-select elements. This is true with and without the multiple option in the html <select> tag. If the element is a single select, attempting to select a new option before de-selecting the current option will result in an Invalid Value Error.


Appendix B: SSL

The HTTP service uses HttpClient allows for navigation of ssl sites through the use of JSSE which is bundled with J2SE 1.4. JSSE also is available with J2SE 1.3 but requires some configuration and is not as robust.

Https is the protocol recognized by HttpClient for SSL. See the HttpClient SSL guide for more information.

Invalid JSSE configuration can be recognized by an RC 4000 when accessing a secure site with a java.lang.NoClassDefFoundError: javax/net/ssl/SSLSocketFactory message.

Notes:

  1. When authenticating with cookies, if you are having trouble logging into a secure site and are not getting error messages on the post, try setting your cookie policy to COMPATIBILITY. It may be that the site you are attempting to log into does not use rc2109 compliant cookies, and you are not setting a needed cookie.

  2. When authenticating with cookies, if you are having trouble logging into a secure site and are receiving a http status code of 3XX on the post, it may be that additional cookies are being set by the page you are being redirected through. Try using the FOLLOWREDIRECT option with the post request.

  3. When submitting a preemptive authentication management request (e.g. specifying a request using the AUTHENTICATIONHOST option), if you are having trouble with authentication denied (401), check the JVMLog to get more detailed realm and host error information.

Examples

Goal: Login to the SourceForge website and go to the user's homepage. This is an example that uses cookies to authenticate.

DOPOST URL http://sourceforge.net/account/login.php PARAMETER form_loginname=user PARAMETER form_pw=password PARAMETER login=Login+With+SSL SESSION 1 RETURNNOCONTENT RETURNHEADERS

DOGET URL https://sourceforge.net/my SESSION 1

Goal: Login to a private site that issues an authentication challenge that must be answered though user/password pop-up prompt. This is an examples that uses preemptive authentication.

SET AUTHENTICATIONHOST www.theSite.com AUTHENTICATIONUSER user AUTHENTICATIONPASSWORD pwd

DOGET URL www.theSite.com/myPersonalSection/index.html


Appendix C: Licenses and Acknowledgements

HttpClient is designed to provide robust support for the base HTTP protocol and be easily extended.

The Commons Logging package is an ultra-thin bridge between different logging libraries. Commons components may use the Logging API to remove compile-time and run-time dependencies on any particular logging package, and contributors may write Log implementations for the library of their choice.

Acknowledgement

This product includes software developed by the Apache Software Foundation (http://www.apache.org/).

                                 Apache License
                           Version 2.0, January 2004
                        http://www.apache.org/licenses/

   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

   1. Definitions.

      "License" shall mean the terms and conditions for use, reproduction,
      and distribution as defined by Sections 1 through 9 of this document.

      "Licensor" shall mean the copyright owner or entity authorized by
      the copyright owner that is granting the License.

      "Legal Entity" shall mean the union of the acting entity and all
      other entities that control, are controlled by, or are under common
      control with that entity. For the purposes of this definition,
      "control" means (i) the power, direct or indirect, to cause the
      direction or management of such entity, whether by contract or
      otherwise, or (ii) ownership of fifty percent (50%) or more of the
      outstanding shares, or (iii) beneficial ownership of such entity.

      "You" (or "Your") shall mean an individual or Legal Entity
      exercising permissions granted by this License.

      "Source" form shall mean the preferred form for making modifications,
      including but not limited to software source code, documentation
      source, and configuration files.

      "Object" form shall mean any form resulting from mechanical
      transformation or translation of a Source form, including but
      not limited to compiled object code, generated documentation,
      and conversions to other media types.

      "Work" shall mean the work of authorship, whether in Source or
      Object form, made available under the License, as indicated by a
      copyright notice that is included in or attached to the work
      (an example is provided in the Appendix below).

      "Derivative Works" shall mean any work, whether in Source or Object
      form, that is based on (or derived from) the Work and for which the
      editorial revisions, annotations, elaborations, or other modifications
      represent, as a whole, an original work of authorship. For the purposes
      of this License, Derivative Works shall not include works that remain
      separable from, or merely link (or bind by name) to the interfaces of,
      the Work and Derivative Works thereof.

      "Contribution" shall mean any work of authorship, including
      the original version of the Work and any modifications or additions
      to that Work or Derivative Works thereof, that is intentionally
      submitted to Licensor for inclusion in the Work by the copyright owner
      or by an individual or Legal Entity authorized to submit on behalf of
      the copyright owner. For the purposes of this definition, "submitted"
      means any form of electronic, verbal, or written communication sent
      to the Licensor or its representatives, including but not limited to
      communication on electronic mailing lists, source code control systems,
      and issue tracking systems that are managed by, or on behalf of, the
      Licensor for the purpose of discussing and improving the Work, but
      excluding communication that is conspicuously marked or otherwise
      designated in writing by the copyright owner as "Not a Contribution."

      "Contributor" shall mean Licensor and any individual or Legal Entity
      on behalf of whom a Contribution has been received by Licensor and
      subsequently incorporated within the Work.

   2. Grant of Copyright License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      copyright license to reproduce, prepare Derivative Works of,
      publicly display, publicly perform, sublicense, and distribute the
      Work and such Derivative Works in Source or Object form.

   3. Grant of Patent License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      (except as stated in this section) patent license to make, have made,
      use, offer to sell, sell, import, and otherwise transfer the Work,
      where such license applies only to those patent claims licensable
      by such Contributor that are necessarily infringed by their
      Contribution(s) alone or by combination of their Contribution(s)
      with the Work to which such Contribution(s) was submitted. If You
      institute patent litigation against any entity (including a
      cross-claim or counterclaim in a lawsuit) alleging that the Work
      or a Contribution incorporated within the Work constitutes direct
      or contributory patent infringement, then any patent licenses
      granted to You under this License for that Work shall terminate
      as of the date such litigation is filed.

   4. Redistribution. You may reproduce and distribute copies of the
      Work or Derivative Works thereof in any medium, with or without
      modifications, and in Source or Object form, provided that You
      meet the following conditions:

      (a) You must give any other recipients of the Work or
          Derivative Works a copy of this License; and

      (b) You must cause any modified files to carry prominent notices
          stating that You changed the files; and

      (c) You must retain, in the Source form of any Derivative Works
          that You distribute, all copyright, patent, trademark, and
          attribution notices from the Source form of the Work,
          excluding those notices that do not pertain to any part of
          the Derivative Works; and

      (d) If the Work includes a "NOTICE" text file as part of its
          distribution, then any Derivative Works that You distribute must
          include a readable copy of the attribution notices contained
          within such NOTICE file, excluding those notices that do not
          pertain to any part of the Derivative Works, in at least one
          of the following places: within a NOTICE text file distributed
          as part of the Derivative Works; within the Source form or
          documentation, if provided along with the Derivative Works; or,
          within a display generated by the Derivative Works, if and
          wherever such third-party notices normally appear. The contents
          of the NOTICE file are for informational purposes only and
          do not modify the License. You may add Your own attribution
          notices within Derivative Works that You distribute, alongside
          or as an addendum to the NOTICE text from the Work, provided
          that such additional attribution notices cannot be construed
          as modifying the License.

      You may add Your own copyright statement to Your modifications and
      may provide additional or different license terms and conditions
      for use, reproduction, or distribution of Your modifications, or
      for any such Derivative Works as a whole, provided Your use,
      reproduction, and distribution of the Work otherwise complies with
      the conditions stated in this License.

   5. Submission of Contributions. Unless You explicitly state otherwise,
      any Contribution intentionally submitted for inclusion in the Work
      by You to the Licensor shall be under the terms and conditions of
      this License, without any additional terms or conditions.
      Notwithstanding the above, nothing herein shall supersede or modify
      the terms of any separate license agreement you may have executed
      with Licensor regarding such Contributions.

   6. Trademarks. This License does not grant permission to use the trade
      names, trademarks, service marks, or product names of the Licensor,
      except as required for reasonable and customary use in describing the
      origin of the Work and reproducing the content of the NOTICE file.

   7. Disclaimer of Warranty. Unless required by applicable law or
      agreed to in writing, Licensor provides the Work (and each
      Contributor provides its Contributions) on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
      implied, including, without limitation, any warranties or conditions
      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
      PARTICULAR PURPOSE. You are solely responsible for determining the
      appropriateness of using or redistributing the Work and assume any
      risks associated with Your exercise of permissions under this License.

   8. Limitation of Liability. In no event and under no legal theory,
      whether in tort (including negligence), contract, or otherwise,
      unless required by applicable law (such as deliberate and grossly
      negligent acts) or agreed to in writing, shall any Contributor be
      liable to You for damages, including any direct, indirect, special,
      incidental, or consequential damages of any character arising as a
      result of this License or out of the use or inability to use the
      Work (including but not limited to damages for loss of goodwill,
      work stoppage, computer failure or malfunction, or any and all
      other commercial damages or losses), even if such Contributor
      has been advised of the possibility of such damages.

   9. Accepting Warranty or Additional Liability. While redistributing
      the Work or Derivative Works thereof, You may choose to offer,
      and charge a fee for, acceptance of support, warranty, indemnity,
      or other liability obligations and/or rights consistent with this
      License. However, in accepting such obligations, You may act only
      on Your own behalf and on Your sole responsibility, not on behalf
      of any other Contributor, and only if You agree to indemnify,
      defend, and hold each Contributor harmless for any liability
      incurred by, or claims asserted against, such Contributor by reason
      of your accepting any such warranty or additional liability.

   END OF TERMS AND CONDITIONS

   APPENDIX: How to apply the Apache License to your work.

      To apply the Apache License to your work, attach the following
      boilerplate notice, with the fields enclosed by brackets "[]"
      replaced with your own identifying information. (Don't include
      the brackets!)  The text should be enclosed in the appropriate
      comment syntax for the file format. We also recommend that a
      file or class name and description of purpose be included on the
      same "printed page" as the copyright notice for easier
      identification within third-party archives.

   Copyright [yyyy] [name of copyright owner]

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.

XML Parser for Java (Xerces) is a validating XML parser and processor written in 100% pure Java; it is a library for parsing and generating XML documents. This parser easily enables an application to read and write XML data.

Commons Codec provides implementations of common encoders and decoders such as Base64, Hex, various phonetic encodings, and URLs.

Acknowledgement

This product includes software developed by the Apache Software Foundation (http://www.apache.org/).

License

/*
 * The Apache Software License, Version 1.1
 *
 *
 * Copyright (c) 1999-2004 The Apache Software Foundation.  All rights 
 * reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer. 
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. The end-user documentation included with the redistribution,
 *    if any, must include the following acknowledgment:  
 *       "This product includes software developed by the
 *        Apache Software Foundation (http://www.apache.org/)."
 *    Alternately, this acknowledgment may appear in the software itself,
 *    if and wherever such third-party acknowledgments normally appear.
 *
 * 4. The names "Xerces" and "Apache Software Foundation" must
 *    not be used to endorse or promote products derived from this
 *    software without prior written permission. For written 
 *    permission, please contact apache@apache.org.
 *
 * 5. Products derived from this software may not be called "Apache",
 *    nor may "Apache" appear in their name, without prior written
 *    permission of the Apache Software Foundation.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 * ====================================================================
 *
 * This software consists of voluntary contributions made by many
 * individuals on behalf of the Apache Software Foundation and was
 * originally based on software copyright (c) 1999, International
 * Business Machines, Inc., http://www.ibm.com.  For more
 * information on the Apache Software Foundation, please see
 * <http://www.apache.org/>.
 */



NekoHTML is a simple HTML scanner and tag balancer that enables application programmers to parse HTML documents and access the information using standard XML interfaces.

Acknowledgement

This product includes software developed by Andy Clark.

License

The CyberNeko Software License, Version 1.0

 
(C) Copyright 2002, Andy Clark.  All rights reserved.
 
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:

1. Redistributions of source code must retain the above copyright
   notice, this list of conditions and the following disclaimer. 

2. Redistributions in binary form must reproduce the above copyright
   notice, this list of conditions and the following disclaimer in
   the documentation and/or other materials provided with the
   distribution.

3. The end-user documentation included with the redistribution,
   if any, must include the following acknowledgment:  
     "This product includes software developed by Andy Clark."
   Alternately, this acknowledgment may appear in the software itself,
   if and wherever such third-party acknowledgments normally appear.

4. The names "CyberNeko" and "NekoHTML" must not be used to endorse
   or promote products derived from this software without prior 
   written permission. For written permission, please contact 
   andy@cyberneko.net.

5. Products derived from this software may not be called "NekoHTML",
   nor may "NekoHTML" appear in their name, without prior written
   permission of the author.

THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

====================================================================

This license is based on the Apache Software License, version 1.1.