!--a11y-->
With OnRequest, you specify the actions to be performed when this page is called by a HTTP request.

These actions are performed regardless of whether the page is reached by explicit navigation (that is, a user entered the URL in a browser or clicked on a link to the page) or not.
OnRequest contains the following code:
|
IF application->m_basket IS NOT INITIAL. * fill basket from cookie CALL METHOD application->do_restore_basket EXPORTING runtime = runtime. ENDIF. |
If the shopping basket is empty and stateless mode is active, the shopping basket is restored by means of the cookie. The application needs to be restored if, for example, the user temporarily leaves the site and then returns at a later point.

If the basket was empty, it is of course still empty after the event handler runs.
The method do_restore_basket of the class CL_BSP_TUTORIAL functions as follows:
|
method DO_RESTORE_BASKET . * ... data: serialized type string.
* restore shopping basket from cookie call method runtime->server->request->get_cookie exporting name = 'bspbasket' importing value = serialized.
call method do_instantiate_basket exporting serialized = serialized.
endmethod. |
First, the cookie is fetched from the client. The cookie contains the serialized content of the shopping basket. This content is eventually re-entered in the shopping basket structure when
do_instantiate_basket is called.See also:
Application Class