Internet Script Classes (iScript)

This chapter describes how an Internet Script (iScript) works in your application, how to create an iScript, and the Internet Script classes that you use in your PeopleCode. It also discusses the following topics:

Click to jump to parent topicUnderstanding Internet Script Classes

An Internet Script, also called an iScript, is a specialized PeopleCode function that generates dynamic web content. iScripts interact with web clients (browsers) using a request-response paradigm based on the behavior of the Hypertext Transfer Protocol.

iScripts work with PeopleSoft Pure Internet Architecture. You must have PeopleSoft Pure Internet Architecture set up correctly before you can run an iScript.

The following flow chart shows the interaction of an iScript (PeopleCode) in a PeopleSoft Pure Internet Architecture application.

Communication flow chart for Internet Scripts

  1. An HTTP request arrives at the web server specifying in its URL the Presentation Relay Servlet (psc). The path information included in the URL specifies which PeopleCode program to run. No component is specified because none is needed. The PeopleCode program (iScript) runs directly. The following is an example of the URL:

    http://serverx/Servlets/psp/ps84/e_procurement/fdm/s/WEBLIB_BEN_401k.PAGES.Field⇒ Formula.IScript_Home401k

  2. The psc servlet is invoked by the web server. It serializes all necessary information from the web server request and response objects, then makes a call through JOLT to the PeopleSoft application server service passing the serialized object information.

  3. The application server unpacks all of the object information and creates PeopleSoft versions of the Request and Response objects. It then calls the function in the PeopleCode program specified in the URL. The PeopleCode Request and Response objects are available to the PeopleCode program through the system variables %Request and %Response.

  4. The PeopleCode program is then responsible for generating every aspect of the HTML page that is to be returned to the browser. It has access to the Request object to view items such as query string parameters, cookies, and headers. It also has access to component interfaces, business interlinks, and Rowset objects to interact with applications. HTML definitions are available to include language sensitive blocks of HTML. They can also contain JavaScript. The message catalog is also available for language sensitive messages. The Response object is used to "write" the generated HTML back to the browser.

  5. When the PeopleCode program is finished running, the headers, cookies, and HTML in the PeopleSoft Response object are serialized and returned through JOLT to the Presentation Relay Servlet.

  6. The Presentation Relay Servlet then unpacks the Response information generated by the PeopleCode.

  7. The servlet plays the information back to the web server response object, which in turn sends the response to the user's browser.

Click to jump to parent topicURL vs. URI

In this document, the term URL refers to the entire URL, that points to content. The following is an example of a URL:

http://someserver/servlets/psc/ps84/e_procurement/fdm/s/WEBLIB_Portal.Field⇒ Change.IScript_DoSomething?page=view&key1=value1&key2=value2

A URI does not include the content information. Think of it as a subset of the URL that points to the location of the resource, but does not include any parameters passed to that resource. From the previous example, the URI portion of the URL is:

http://someserver/servlets/psc/ps84

Click to jump to parent topicWeb Libraries

iScripts use the existing PeopleCode Function Library infrastructure. However, instead of naming your record FUNCLIB_xxx, all iScripts must be contained in records named WEBLIB_xxx. All of the existing tools and techniques for working with function libraries (such as Upgrade, Find In, Rename, and so on) also apply to Web Libraries.

See Accessing PeopleCode External Functions.

To create an iScript:

  1. Create or extend a domain specific WEBLIB (funclib).

    WEBLIBs are derived/work record definitions that have their name prefixed with WEBLIB_.

  2. Add a function to a WEBLIB.

    The name of your function must be prefaced with IScript_. For example:

    IScript_HelloWorld IScript_FuncHRPage

Note. iScript functions take no arguments, and do not return a value.

The following iScript writes data.

Function IScript_HPDefaultCategories() &ClearDotImage = %Response.GetImageURL(Image.PT_PORTAL_CLEAR_DOT); &CatHTML = GetHTMLText(HTML.PORTAL_HP_CATEGORY, &ClearDotImage, GetCategories⇒ ()); %Response.Write(&CatHTML); End-Function;

The following iScript uses both the request and response objects to echo what the user types into an edit control.

Function IScript_HelloWorld() %Response.WriteLine("<html><head><title>Hello World</title></head><body>"); %Response.WriteLine("<h1>Hello World</h1>"); %Response.WriteLine("<form method=POST action = " | %Request.FullURI | "?" |⇒ %Request.QueryString | "><input type=submit value='Say this!'>&nbsp<input type=⇒ edit name=WhatYouSaid value=" | %Request.GetParameter("WhatYouSaid") | "><⇒ /form>"); rem echo back what the user typed into the edit box...; %Response.WriteLine("<p><font face='Arial, Helvetica' size='5' color='blue'⇒ >You said: "); %Response.WriteLine(%Request.GetParameter("WhatYouSaid")); %Response.WriteLine("</body></html>"); Return; End-Function;

Click to jump to parent topiciScript Security

iScripts are secured on your system similar to Component Interfaces. After you create a WEBLIB record, and your functions, you must add them just as you would add a page to an application.

To add security to an iScript :

  1. Navigate to the Maintain Security page and open the Permission List to which you want to give access.

  2. Select Web Libraries.

    You may need to scroll through the tabs at the top of the page to access the Web Libraries tab.

  3. (Optional) Add new WebLibrary for Permission List.

    If this is a new Web Library, you must add it to the permission list. Click the plus button to add a new Web Library, then select the library you want to add from the drop-down list box.

  4. Select Edit for the Web Library you want to grant access for.

  5. Select the access you want to give each function in the WEBLIB record.

    From the page that displays, you can choose to allow or disallow access on a per function basis. The buttons on the side of the page either grant or disallow access for all functions.

See Enterprise PeopleTools 8.50 PeopleBook: PeopleSoft Security Administration

Click to jump to parent topicWhen to Use an iScript

iScripts give you complete control over the HTML sent to the browser. This enables flexibility in creating a user interface. However, there are some responsibilities that you inherit when choosing to use iScripts.

For these reasons, PeopleSoft recommends that you first try to build a page in Application Designer. This approach enables PeopleTools to generate all of the HTML in a cross-browser, multi-language, multi-market, and multi-currency sensitive way.

You don't have to use an iScript to generate an entire page. You can use the Request and Response objects with an HTML area, so you can develop a portion of your HTML using the iScript objects, while allowing the majority of it to be generated by the Component Processor. If you use this method, instead of using the Response object's Write and WriteLine methods to output your HTML, you set the value of the HTML area to the HTML that you want to display. Remember, that just as with an iScript, you must ensure that the HTML you generate is cross-browser compatible and multi-market sensitive.

So when should you use iScripts? Here are two scenarios where iScripts would be an appropriate choice:

See PeopleSoft PeopleBook: Enterprise Portal

Click to jump to top of pageClick to jump to parent topicStyle Sheets and Styles

PeopleSoft recommends that developers using the iScripts always use styles (also known as classes) defined in the style sheets to specify the attributes (that is, background color, font, size, alignment, borders, and so on) of objects referenced in the iScripts. The Response object provides access to Style Sheets stored in the PeopleSoft database.

See Also

Creating Style Sheet Definitions

Click to jump to top of pageClick to jump to parent topicOther Considerations

PeopleSoft does not recommend using the following technologies in iScripts:

Click to jump to parent topicDetails of an iScript URL

Viewing an iScript requires the assembly of a URL with the following pieces:

Section

Description

http://Server/

The scheme (http / https ) and web server name.

servlet_name/

The name of the physical servlet that the web server invokes to handle the request. This is either psp or psc.

SiteName/

The user-defined site name. This is defined during the installation of PIA. This enables you to set up multiple sites on one physical web server.

PortalName/

The name of the portal to use for this request. The portal object contains metadata that describes how to present the content (that is, template, pagelets and so on.)

NodeName/

The name of the node that contains the content for this request.

content_type/

The type of the content for this request. For iScripts, this is "s".

content_id

The identification of the content. This, and the type is the unique key to the content being retrieved.

?content_parm

The query string parameters (name value pairs) for the content.

For an iScript, the content_id has the following form:

Record.Field.Event.Function

The following is an example of the call to an iScript:

http://mlee2038//psp/PS84/e_procurement/fdm/s/WEBLIB_Portal.PORTAL_HEADER.Field⇒ Formula.IScript_UniHeader_PIA

Click to jump to parent topicThe Generate Functions

There are many different types of content on the portal, such as components, iScripts, homepages, and so on. Sometimes you want to access this content directly, through the URL that points to this content. To do this, PeopleSoft provides several Generate functions that generate the URL for the specified content.

The Generate functions can be categorized as:

The following is a list of the functions, plus a description of what to use them for. More information about a function is found under that function's description in the section PeopleCode Built-in Functions.

Function Name

Content Type

Absolute or Relative URL

Portal service or content servlet

GenerateActGuideContentUrl

Activity Guide

Absolute

psc

GenerateActGuidePortalUrl

Activity Guide

Absolute

psp

GenerateActGuideRelativeUrl

Activity Guide

Relative

NA

GenerateComponentContentURL

Component

Absolute

psc

GenerateComponentContentRelURL

Component

Relative

psc

GenerateComponentPortalURL

Component

Absolute

psp

GenerateComponentPortalRelURL

Component

Relative

NA

GenerateComponentRelativeURL

Component

Relative

NA

GenerateExternalPortalURL

External

Absolute

psp

GenerateExternalRelativeURL

External

Relative

NA

GenerateHomepagePortalURL

Homepage

Absolute

psp

GenerateHomepageRelativeURL

Homepage

Relative

NA

GenerateQueryContentURL

WQuery

Absolute

psc

GenerateQueryPortalURL

Query

Absolute

psp

GenerateQueryRelativeURL

Query

Relative

NA

GenerateScriptContentURL

IScript

Absolute

psc

GenerateScriptContentRelURL

IScript

Relative

psc

GenerateScriptPortalURL

Iscript

Absolute

psp

GenerateScriptPortalRelURL

IScript

Relative

psp

GenerateScriptRelativeURL

IScript

Relative

NA

GenerateWorklistPortalURL

Worklist

Absolute

psp

GenerateWorklistRelativeURL

Worklist

Relative

NA

See Also

PeopleCode Built-in Functions

Click to jump to parent topicError Handling

All errors are handled through the session object. You should check the PSMessages collection to see if there are any errors in your code.

Note. Exit(1) does not rollback iScript transactions. To rollback in an iScript, you can use the SqlExec built-in function with the parameter of ROLLBACK (SQLEXEC("ROLLBACK")) or the MessageBox built-in function with a message error severity of error. You can also use the built-in function Error, but only if you are not sending HTML or XML in the error text itself.

See Also

Error Handling

Click to jump to parent topicScope of the Internet Script Classes

The Request, Response, and Cookie classes can be accessed only from PeopleCode. They can be used only as part of a PeopleSoft Pure Internet Architecture application—either as part of a page created in Application Designer or an iScript. An iScript is always contained in a WEBLIB record. You wouldn't use any of these objects in an Application Engine program, a Component Interface, and so on. However, an iScript could call and start a Component Interface, a Business Interlink, and so on.

To access the Request or Response object, use the %Request and %Response system variable. These variables are objects, so you use them with dot notation.

%Response.SetContentType("text/HTML"); If %Request.GetParameter("encode") <> "" Then

Click to jump to parent topicData Types of the iScript Classes

Cookie objects are instantiated from Response object. You can declare the cookie object as data type cookie before any functions. You can also declare variables of type Response and Request, to assign the %Response and %Request system variables to local variables.

Local Cookie &Cookie; Local Response &Resp; Local Request &Req; Function IScript_SetCookie() rem set a cookie called "MyCookie" to store my user id in it's value. Make the cookie expire when the user's browser session expires; &Resp = %Response; &Req = %Request; &Cookie = &Resp.CreateCookie("MyCookie"); &Cookie.Value = %UserId; &Cookie.MaxAge = -1; End-Function;

Click to jump to parent topicInternet Script Classes

The following is a description of the PeopleCode classes, methods, and properties that you use to create an iScript.

Click to jump to top of pageClick to jump to parent topicRequest Class

The Request object encapsulates all information from the request issued from the browser. This includes the URI, Query String, QueryString parameters, Cookies, and Headers. The properties for the Request object are read-only.

Parameters

Request parameters are name-value pairs sent by the client to the web server as part of an HTTP request. They include the pairs in the query string part of the URL, and data posted in a form, if the request was a post request. Multiple parameter values can exist for any given parameter name. The following methods are available to access parameters:

The GetParameterValues method returns an array of String objects containing all the parameter values associated with a parameter name. The value returned from the GetParameter method equals the first value in the array of String objects returned by GetParameterValues.

All form data from both the query string and the post body are aggregated into the request parameter set. The order of this aggregation is that query string data appears before post body parameter data.

Click to jump to top of pageClick to jump to parent topicResponse

The response object encapsulates all the information to be sent back to the browser. This includes the body of the response, content type, response headers, and cookies.

The response object also includes helper methods that retrieve HTML, Image, StyleSheet, and other objects from the database and move them to the web server, and returning strings that can be used to reference these objects in the response content.

The body of the response is created using the response object's Write and WriteLine methods. If the content type of the response is not explicitly set in the PeopleCode program, it defaults to "text/html".

Click to jump to top of pageClick to jump to parent topicCookies

Cookies are data sent from the client to the server on every request that the client makes. Cookies are stored by the browser, either on disk or in memory, and returned to the server that originally set the cookie.

The Internet Script API makes available the name and value of each cookie that's sent with the request, through the Request object's GetCookieNames and GetCookieValue methods. The API also enables you to set new cookies (or alter existing cookies) through the Response object's CreateCookie method and the Cookie object's properties.

Click to jump to parent topicInternet Script Classes Built-in Functions

GenerateActGuideContentUrl

GenerateActGuidePortalUrl

GenerateActGuideRelativeUrl

GenerateComponentContentRelURL

GenerateComponentContentURL

GenerateComponentPortalRelURL

GenerateComponentPortalURL

GenerateComponentRelativeURL

GenerateExternalPortalURL

GenerateExternalRelativeURL

GenerateHomepagePortalURL

GenerateHomepageRelativeURL

GenerateQueryContentURL

GenerateQueryPortalURL

GenerateQueryRelativeURL

GenerateScriptContentRelURL

GenerateScriptContentURL

GenerateScriptPortalRelURL

GenerateScriptPortalURL

GenerateScriptRelativeURL

GenerateWorklistPortalURL

GenerateWorklistRelativeURL

Click to jump to parent topicRequest Class Methods

In this section, we discuss the Request class methods. The methods are discussed in alphabetical order.

Click to jump to top of pageClick to jump to parent topicGetContentBody

Syntax

GetContentBody()

Description

Note. PeopleSoft Business Interlinks is a deprecated product. This method currently exists for backward compatibility only.

This method retrieves the text content of an XML request. This is part of the incoming Business Interlink functionality, which enables PeopleCode to receive an XML request and return an XML response.

Parameters

None.

Returns

A string.

Example

The following example gets the XML text content of a request, then uses that as input to create a BiDoc. Then the BiDoc methods GetDoc and GetValue are used to access the value of the skills tag.

Local BIDocs &rootInDoc, &postreqDoc; Local string &blob; Local number &ret; ​&blob = %Request.GetContentBody(); ​/* process the incoming xml(request)- Create a BiDoc */ &rootInDoc = GetBiDoc(&blob); &postreqDoc = &rootInDoc.GetDoc("postreq"); &ret = &postreqDoc.GetValue("skills", &skills);

Click to jump to top of pageClick to jump to parent topicGetCookieNames

Syntax

GetCookieNames()

Description

This method returns an array containing names of all the cookies present in this request. If there are no cookies in the request, an empty array is returned. When cookies are present, this method returns an array of strings.

Click to jump to top of pageClick to jump to parent topicGetCookieValue

Syntax

GetCookieValue (name)

Description

This method returns a string containing value of the cookie identified name. The name parameter takes a string value. The NPmatch between name and the request cookie is case-insensitive. If there is no cookie in the request matching the name, an empty string is returned.

Click to jump to top of pageClick to jump to parent topicGetHeader

Syntax

GetHeader(name)

Description

This method returns the value of the header requested by the string name. The match between name and the request header is case-insensitive. If the header requested does not exist, an empty string is returned.

Example

The following example gets the "Referer" header to see where the request came from:

&Referer = %Request.GetHeader("Referer");

Click to jump to top of pageClick to jump to parent topicGetHeaderNames

Syntax

GetHeaderNames()

Description

This method returns an array of Strings representing the header names for this request.

Click to jump to top of pageClick to jump to parent topicGetHelpURL

Syntax

GetHelpURL(HelpContext)

Description

This method returns the help context path (as a string) to the help directory. It's used to construct a URL to a specific help page.

Example

&HelpURLString = %Request.GetHelpURL("hc0110");

Click to jump to top of pageClick to jump to parent topicGetParameter

Syntax

GetParameter(name)

Description

This method returns the value of a specified query string parameter or posted form data parameter. The match between name and the request parameter is case-insensitive. If there are multiple parameter values for a single name, the value returned is the first value in the array returned by the GetParameterValues method. If the parameter has (or could have) multiple values, you should use the GetParameterValues method in your Internet scripts.

See Also

Request class: GetParameterValues method.

Click to jump to top of pageClick to jump to parent topicGetParameterNames

Syntax

GetParameterNames()

Description

This method returns all the parameter names for this request as an array of Strings, or an empty array if there are no input parameters.

Click to jump to top of pageClick to jump to parent topicGetParameterValues

Syntax

GetParameterValues(name)

Description

This method returns the values of the specified parameter (name) as an array of Strings, or an empty array if the named parameter does not exist. The name parameter takes a string value.

Click to jump to parent topicRequest Class Properties

In this section, we discuss the Request class properties. The properties are discussed in alphabetical order.

Click to jump to top of pageClick to jump to parent topicAuthTokenDomain

Description

This property returns the web server domain as a string across which the single signon authentication token is valid. Use this property as the domain of any cookie which you want to apply across the same domain as the single signon token.

The value of this property is in the format:

".domain.com"

Note that it begins with a dot "." character. You can use this format as the value of a cookie's domain property.

However, sometimes you cannot use a value that is prefixed with a dot character. For example, the javascript document.docmain property should not begin with a dot. In this case, you must strip it off manually in your code.

Note. The value of this property is the domain across which the authentication token is valid, set in the AuthTokenDomain configuration property in the configuration properties file. The value of the system variable %AuthenticationToken is the authentication token itself.

This property is read-only.

See Also

%AuthenticationToken.

Click to jump to top of pageClick to jump to parent topicAuthType

Description

This property corresponds to the CGI variable AUTH_TYPE. This variable does not necessarily contain a value, and may require special web server configuration to obtain non-empty values.

This property is read-only.

See Also

RemoteUser, ServletPath.

Click to jump to top of pageClick to jump to parent topicByPassSignOn

Description

This property returns a Boolean value, indicating what ByPassSignOn has been set to in the configuration properties file. If this value has been set to True, this property returns True, False otherwise.

This property is read-only.

Click to jump to top of pageClick to jump to parent topicBrowserPlatform

Description

This property returns a string containing the value the web server passes as the browser platform.

This property is read-only.

Click to jump to top of pageClick to jump to parent topicBrowserType

Description

This property returns a string describing the browser that sent the request.

This property is read-only.

Click to jump to top of pageClick to jump to parent topicBrowserVersion

Description

This property returns a string describing the version of the browser that sent the request.

This property is read-only.

Click to jump to top of pageClick to jump to parent topicContentURI

Description

This property returns a string containing the portion of the current URI before the portal name, and referencing the content servlet (psc).

For the URL:

http://localhost/psc/ps84/PORTAL/NODE/e_procurement/fdm/s/WEBLIB. . .

This property returns the following:

http://localhost/psc/ps84/

This property is read-only.

Click to jump to top of pageClick to jump to parent topicExpireMeta

Description

This property returns the refresh meta-tag string that contains the cmd=expire parameter (the ExpireMeta string.)

The following is an example of the ExpireMeta string:

<meta HTTP-EQUIV='Refresh' Target='_top' CONTENT='10; URL=/servlets/psp/ps84/?cmd=⇒ expire'>

All Internet script pages should use this property to generate the meta tag to cause the page to expire. It is the same expiration tag used by pages originally created using Application Designer, unless the Internet script generates a menu link in a separate frame that is not supposed to expire.

This tag should be included in the <head> section of the HTML generated by the iScript.

This property is read-only.

Example

%Response.Write("<html><head>"); %Response.Write(%Request.ExpireMeta); %Response.Write("</head><body>");

Click to jump to top of pageClick to jump to parent topicFullURI

Description

This property returns the complete URI up to, but not including, the query string. This method returns a string value.

To return only the request URI (that is, without the scheme, server name or port) use the RequestURI method.

This property is read-only.

Example

From the following code

&FullURI = &Request.FullURI;

&FullURI might contain the following:

http://serverx/servlets/psp/ps84/Portal/Node/s/WEBLIB_TEST.SCRIPTS.Field⇒ Formula.IScript_Test

See Also

Request class: RequestURI property.

Click to jump to top of pageClick to jump to parent topicHTTPMethod

Description

This property returns the HTTP method as a string, (for example, GET, POST, PUT) by which this request was made.

This property is read-only.

Click to jump to top of pageClick to jump to parent topicLogoutURL

Description

This property returns the complete URL (as a string) to logout of the PeopleSoft session. Use this property to generate a link that causes a page to logout. You should normally not need to include this link on your page.

This property is read-only.

Click to jump to top of pageClick to jump to parent topicPathInfo

Description

This property returns any path information following the servlet path, but prior to the query string. This property returns null if there is no path information following the servlet path.

This property is read-only.

Example

For the URL:

http:/localhost/psp/ps84/PORTAL/NODE/e_procurement/fdm/s/WEBLIB. . .

This property returns the following:

psp84/PORTAL/NODE/eprocurements/fdm/s/WEBLIB_. . .

Click to jump to top of pageClick to jump to parent topicProtocol

Description

This property returns the protocol being used for this request as a string in the following form:

protocol/major_version.minor_version

An HTTP 1.0 request, as defined by the HTTP 1.0 specification, should return the string HTTP/1.0. Use the Scheme property instead of the Protocol property when generating hrefs (links).

This property is read-only.

Click to jump to top of pageClick to jump to parent topicQueryString

Description

This property returns the query string present in the request URL, if any. A query string is defined as any information following a ? character in the URL.

If there is no query string, this method returns null.

Use the request Parameters methods (GetParameterNames, GetParameterValues, GetParameter) to get the values of individual parameters on the query string.

This property is read-only.

Click to jump to top of pageClick to jump to parent topicRelativeURL

Description

This property returns whether a relative URL should be generated for PeopleSoft Pure Internet Architecture pages. This property is set in the configuration properties file. This property takes a Boolean value: True if a relative URL is generated for PeopleSoft Pure Internet Architecture pages, False otherwise.

This property is read-only.

Click to jump to top of pageClick to jump to parent topicRemoteAddr

Description

This property returns the IP address of the agent that sent the request.

This property is read-only.

Click to jump to top of pageClick to jump to parent topicRemoteHost

Description

This property returns the fully qualified host name of the agent that sent the request.

This property is read-only.

Click to jump to top of pageClick to jump to parent topicRequestURI

Description

This property returns the URI, without the protocol.

This property is read-only.

Example

This example uses the following URL:

http://serverx/servlets/psc/ps84/PORTAL/NODE/fdm/s/WEBLIB_Portal. . .

From the following code

&MyRequestURI = &Request.RequestURI;

&MyRequestURI contains the following:

/servlets/psc/ps84/PORTAL/NODE/fdm/s/WEBLIB_PORTAL . . .

Use the following to build an absolute URL:

&myURL = &Request.Scheme | "://" | &Request.ServerName | ":" | &Request.Port | ​⇒ &Request.RequestURI | "?" | &Request.QueryString;

Click to jump to top of pageClick to jump to parent topicRemoteUser

Description

This property corresponds to the CGI variable REMOTE_USER. It is not specific to your PeopleSoft implementation.

This variable does not necessarily contain a value, and may require special web server configuration to obtain non-empty values.

This value is generally populated when J2EE Authentication is enabled in the web-server configuration. The specific implementation of your web-server dictates how exactly this variable is populated. See your web-server specific documentation for more information.

This property is read-only.

See Also

AuthType, ServletPath.

Click to jump to top of pageClick to jump to parent topicScheme

Description

This property returns the scheme, also known as the protocol, used by the request. Common schemes include http, https, ftp, and telnet. This property returns a string value.

This property is read-only.

Example

For the URL

http://serverx/servlets/psp/ps84/eprocurement/fdm/s/WEBLIB. . . .

the Scheme property returns:

http

Click to jump to top of pageClick to jump to parent topicServerName

Description

This property returns the host name of the server on which the servlet is running. This property returns a string value.

This property is read-only.

Example

For the URL

http://serverx/servlets/psp/ps84/eprocurement/fdm/s/WEBLIB. . . .

the ServerName property returns:

serverx

Click to jump to top of pageClick to jump to parent topicServerPort

Description

This property returns an integer representing the port on which the browser's request was received (that is, the port on which the server is listening.)

This property is read-only.

Example

For the URL

http://servername:80/servlets/iclientservlet/peoplesoft8/?ICType=Panel. . .

the ServerPort property returns:

80

Click to jump to top of pageClick to jump to parent topicServletPath

Description

This property corresponds to the CGI variable SCRIPT_NAME. This variable does not necessarily contain a value, and may require special web server configuration to obtain non-empty values.

This property is read-only.

See Also

AuthType, RemoteUser.

Click to jump to top of pageClick to jump to parent topicTimeout

Description

This property returns an integer representing the timeout value, in seconds, set in the configuration.properties file.

This property is read-only.

Click to jump to parent topicResponse Class

The response object encapsulates all information to be returned from the iScript to the browser.

Click to jump to parent topicResponse Class Methods

In this section, we discuss the Response class methods. The methods are discussed in alphabetical order.

Click to jump to top of pageClick to jump to parent topicClear

Syntax

Clear()

Description

This method removes all cookies and headers as well as deletes any HTML that has been written to the Response object. After using this method, the Response object appears as it did when the script was first called.

Click to jump to top of pageClick to jump to parent topicCreateCookie

Syntax

CreateCookie(name)

Description

This method adds a cookie to the response with the name specified by the string name. It returns a reference to the cookie object that is used to update the values of this cookie. If the cookie by the specified name already exists, a reference to the existing cookie is returned. This method can be called multiple times to set more than one cookie. Cookie names may not contain the "$" character.

Important! Certain browsers have limit of either 20 or 50 cookies per web server domain depending on the browser security update that the user has applied. The browser randomly discards some cookies when that number is exceeded.

PeopleTools uses eight cookies. In addition, the number of cookies used by PeopleTools can grow depending on the number of sites that the user visits within the same domain. Some PeopleSoft applications use additional cookies. Therefore, you might or might not be able to create your own cookies to modify an existing PeopleSoft application. If you do create your own cookies, keep the use conservative. Otherwise, your application might end up causing the browser to discard critical signon or authentication cookies.

More information about browser limitations can be found online.

See “Troubleshooting Browser Limitations” on My Oracle Support.

Click to jump to top of pageClick to jump to parent topicGetCookie

Syntax

GetCookie(name)

Description

This method returns the cookie object specified by the string name. If the cookie is not already present in this response, a null value is returned.

Click to jump to top of pageClick to jump to parent topicGetCookieNames

Syntax

GetCookieNames()

Description

This method returns an array of strings that contains the names of all the cookies present in this response. If there are no cookies in the response, an empty array is returned.

Click to jump to top of pageClick to jump to parent topicGetHeader

Syntax

GetHeader(name)

Description

This method returns the value of the response header requested by the string name. The match between name and the response header is case-insensitive. If the header requested does not exist, an empty string is returned.

Click to jump to top of pageClick to jump to parent topicGetHeaderNames

Syntax

GetHeaderNames()

Description

This method returns an array of Strings representing the header names for this response.

Click to jump to top of pageClick to jump to parent topicGetImageURL

Syntax

GetImageURL(IMAGE.ImageName | rowset.row.record)

Description

This method returns a string which represents the URL of the requested image, for images in the database.

Because the image field is a long data type, you can have only one on the record. Therefore you must specify the record only. The field on the record is assumed to be the image.

Note. The GetImageURL method cannot be used with a derived work record.

Parameters

imagename

Specify the name of an existing image. This name must be prefaced with the reserved word IMAGE.

rowset.row.record

Specify the path to the image, that is, the rowset, row, and record.

Example

The following example gets the URL to use for the image, and the second uses the URL reference.

&strImage = %Response.GetImageURL(Image.ARROW); %Response.WriteLine("<img src=" | &strImage | ">");

The following gets an image from the record.

%Response.GetImageURL(&rs.GetRow(1).GetRecord(Record.EMPL_PHOTO));

Click to jump to top of pageClick to jump to parent topicGetJavaScriptURL

Syntax

GetJavaScriptURL(HTML.HTMLname)

Description

This method returns a string which represents the URL of the requested HTML definition, for JavaScript HTML definitions stored in the database.

Example

This example assumes the existence in the database of an HTML definition called "HelloWorld_JS", that contains some JavaScript.

Function IScript_TestJavaScript() %Response.WriteLine("<script src= " | %Response.GetJavaScriptURL(HTML.Hello⇒ World_JS) | "></script>"); End-Function;

In this example, the HTML definition is called FOO. The following PeopleCode example:

%Response.GetJavaScriptURL(HTML.FOO)

Resolves to something similar to:

http://myserver/cache/js/FOO_ENG_1.js

See Also

Creating HTML Definitions.

Click to jump to top of pageClick to jump to parent topicGetStyleSheetURL

Syntax

GetStyleSheetURL(STYLESHEET.stylename)

Description

This method returns a URL string pointing to a style sheet created in Application Designer.

Example

In the following example, the first line gets the URL to use for the style sheet, and the second is the standard HTML to include the style sheet in the HTML document. The stylesheet link must be included in the HTML before any of the styles in the stylesheet are used. It should be included in the <head> section of the HTML document.

&strStyleSheet = %Response.GetStyleSheetURL(StyleSheet.BENEFITS_STYLE); %Response.WriteLine("<link rel=stylesheet href=" | &strStyleSheet | " type=""text⇒ /css"">");

Now to use a style, assign the class attribute of your choice to your HTML tags, as follows:

%Response.WriteLine("<p class=PSTEXT>I am some classy text!!</p>");

Click to jump to top of pageClick to jump to parent topicRedirectURL

Syntax

RedirectURL(location)

Description

This method sends a temporary redirect response to the client using the location specified by the string location. The given location must be an absolute URL. No further output should be made by the iScript after calling this method.

Note. If your URL string contains special characters (such as foreign characters) make sure you encode it first using the EncodeURL function, such as, %Response.RedirectURL(EncodeUrl(&Url)).

In addition, while you can redirect relative URLs in certain circumstances, you cannot encode them.

Example

%Response.RedirectURL(&URL);

See Also

EncodeURL.

Click to jump to top of pageClick to jump to parent topicSetContentType

Syntax

SetContentType(Type)

Description

This method sets the content type for this response. The parameter type takes a string value. This type may later be implicitly modified by the addition of properties such as the MIME charset property if the service finds it necessary and the appropriate property has not been set.

The content type defaults to "text/html" if it is not set.

Click to jump to top of pageClick to jump to parent topicSetHeader

Syntax

SetHeader(name, value)

Description

This method sets a response header with the specified name and value. Both parameters take string values. If the field has already been set with a value, this new value overwrites the previous one.

Example

The PortalRegisteredURL response header identifies to the portal the registered URL of the current content, so that it can find the correct content reference to look at for the template.

You can override the value of the PortalRegisteredURL response header in a PIA Script or PIA Page by adding the header to the response yourself, like this:

%Response.SetHeader("PortalRegisteredURL", &myURL);

You can do this to register the content with additional parameters.

Click to jump to top of pageClick to jump to parent topicUseSimpleURL

Syntax

UseSimpleURL({True | False})

Description

The UseSimpleURL method sets the response header that informs the portal that the current content uses relative simple URLs, and does not have to be proxied.

By default, all PeopleSoft Pure Internet Architecture content sets the header to true. You must to call this method to specify that your content does not use the simple URL format, and therefore does need to be proxied.

Parameters

True | False

Specify a Boolean value, either True or False, to indicate whether simple URLs are used.

Returns

None.

Click to jump to top of pageClick to jump to parent topicWrite

Syntax

Write(String)

Description

This method prints String to the HTTP output stream.

You can use an HTML string from Application Designer HTML catalog with the Write method if you also use the GetHTMLText function, as follows:

%Response.Write(GetHTMLTEXT(HTML.MY_HTML));

You can also use an XML string. The following example takes a BiDocs structure that contains an XML response and puts that into a text string. After this is done, the %Response.Write function can send this as an XML response.

Local BIDocs &rootDoc; Local string &xmlString; &xmlString = %Response.GetContentBody(); &rootDoc = GetBIDoc(&xmlString); /* do processing */ &xmlString = &rootDoc.GenXMLString(); ​%Response.Write(&xmlString);

Click to jump to top of pageClick to jump to parent topicWriteLine

Syntax

WriteLine(String)

Description

This method adds a carriage control and line feed to the end of the string String, then prints the string to the HTTP output stream.

You can use an HTML string from Application Designer HTML catalog with the WriteLine method if you also use the GetHTMLText function, as follows:

%Response.WriteLine(GetHTMLTEXT(HTML.MY_HTML));

Click to jump to parent topicResponse Class Properties

In this section, we discuss the Response class properties.

Click to jump to top of pageClick to jump to parent topicCharset

Description

This property returns the character set used by the response object as a string. This value is set in the user personalizations.

This property is read-only.

See Also

Managing PeopleSoft Personalizations.

Click to jump to top of pageClick to jump to parent topicDefaultStyleSheetName

Description

This property returns the name of the default style sheet defined on the PeopleTools Options page. If not defined, PSSTYLEDEF is returned.

This property is read-only.

See Also

PeopleTools Options.

Click to jump to parent topicCookie Class

The cookie class encapsulates all information to be sent to the browser for a single cookie. The cookie class is used by the response object to set new cookies. The request object uses a simple name-value pair mechanism for retrieving previously stored cookie values sent with the HTTP request.

Click to jump to parent topicCookie Class Properties

In this section, we discuss the Cookie class properties. The properties are discussed in alphabetical order.

Click to jump to top of pageClick to jump to parent topicDomain

Description

This property returns the domain of this cookie, or null if not defined. This property is a string value.

This property is read-write.

Example

&cookie = &Response.AddCookie("My cookie", "My value"); &cookie.Domain = ".MyDomain.com";

Click to jump to top of pageClick to jump to parent topicMaxAge

Description

This property represents the maximum specified age of the cookie, as a signed number in seconds. The default value is -1. Setting the MaxAge property to a negative value ensures the cookie does not persist on the client when the client session ends. If the MaxAge property is set to zero, the cookie is deleted immediately from the client.

Value

Description

Non Negative Integer

Lifetime of the Cookie in seconds

0

Delete the cookie from the client immediately

-1

Default MaxAge property value (remove the cookie after the client exits)

Negative Integer

Remove the cookie after the client exits

This property is read-write.

Click to jump to top of pageClick to jump to parent topicName

Description

This property returns the name of the cookie as a string.

This property is read-only.

Click to jump to top of pageClick to jump to parent topicPath

Description

This property returns the prefix of all the URL paths for which this cookie is valid, or an empty string if not defined.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicSecure

Description

This property specifies whether the cookie is to be secured. This property takes a Boolean value. The default value is False. Secure cookies are sent only if the client has established a secure link (such as HTTPS) with the server. This property is read-write.

Click to jump to top of pageClick to jump to parent topicValue

Description

This property returns the value of the cookie (as a string), or an empty string if it isn't defined.

This property is read-write.