01.06.2013 Views

OpenEdge Development: Mobile Applications - Product ...

OpenEdge Development: Mobile Applications - Product ...

OpenEdge Development: Mobile Applications - Product ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

onOpenRequest property<br />

onOpenRequest property<br />

Returns a developer-specified callback function that the Session object executes to<br />

modify a request object before sending the request object to the server. Such a function<br />

might serve, for example, to add a header to the request.<br />

It is not normally necessary to use this property, because <strong>OpenEdge</strong> <strong>Mobile</strong> properly<br />

handles preparation of the request object for normal circumstances.<br />

Data type: function<br />

Access: Writable<br />

Applies to: progress.data.Session class<br />

By default, the value of the onOpenRequest property is null, meaning that the request<br />

object is sent without modification. If the value is set to a function, the function takes a<br />

single parameter.<br />

Syntax<br />

mysession.onOpenRequest = myFunction( params )<br />

params<br />

An object that has the following properties:<br />

• xhr — An object reference to the XMLHttpRequest object (XHR) to be used to<br />

send the request. The current request object can be modified by the function.<br />

When the callback is called, XMLHttpRequest.open( ) will already have been<br />

called on the XHR , but the callback can call open( ) again, overriding the effects<br />

of the first open( ). When the callback function is used for a login( ),<br />

addCatalog( ), or logout( ) call, although it should not be necessary and is not<br />

recommended, it is possible to replace the XHR entirely by creating a new object<br />

and assigning it as the value of the xhr property.<br />

• verb — The HTTP operation (GET, PUT, etc.) to be performed by the request.<br />

• uri — The URI to which the request is addressed.<br />

• session — A reference to the Session object that invoked the callback.<br />

• formPreTest — A Boolean specifying whether the current login( ) request is a<br />

preliminary request, used in cases of Form authentication, to determine whether<br />

the user is already logged in (true) or an actual login request (false).<br />

• async — A Boolean specifying whether the request is asynchronous (true) or<br />

synchronous (false).<br />

Note: If the callback function is used for a login( ), addCatalog( ), or<br />

logout( ) call, and if it calls XMLHttpRequest.open( ), the request must<br />

be sent synchronously.<br />

<strong>OpenEdge</strong> ® <strong>Development</strong>: <strong>Mobile</strong> <strong>Applications</strong> 235

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!