|
|
|
|
|
- Overview
- How to?
- To implement the management of AWP contexts via cookies:
- To implement the management of AWP contexts on disk:
- WLanguage functions for managing AWP contexts
To keep the value of global variables when switching from a page to another one, the AWP mode proposes a management of contexts. Two modes are available for managing the contexts: - Context management using cookies: the value of various variables is stored on the user's browser using a cookie. This management mode presents several drawbacks:
- the cookies must be supported by the browser of the Web user
- the size of the cookies cannot exceed 4 KB
- the security of the information stored in the cookie is not guaranteed.
- Context management on disk The values of the various variables are stored in a file on the server. A context identifier is used to retrieve the context stored. This identifier can be stored via a cookie on the computer of the Web user or transmitted on the URL. This identifier guarantees the security of stored data.
Note If several AWP contexts are present on the same domain, these contexts are totally independent. The identifier of the AWP context is unique per domain and per site. To implement the management of AWP contexts via cookies: - Use ConfigureAWPContext to specify the management mode of AWP context. This function should be used in the initialization process of project. Indeed, the selected mode cannot be modified when the session is started.
To use the management of contexts via cookies, the following line of code can be used:
ConfigureAWPContext(ctxCookie)
- Use DeclareAWPContext to store or get the value of the desired variables. This function should be used in the project initialization code (for the project variables) and/or in the initialization code of the pages (for page variables). In most cases, this function must be used in the process where the variables are declared and initialized.
Remarks: In this operating mode: - DeclareAWPContext uses the HTTP cookies. The values of variables will not be restored if the HTTP cookies are ignored by the browser used on the current computer.
- The total size of values for the different variables cannot exceed 4KB. If the size of these values is too important, these values will be truncated (missing variable and/or truncated content).
- DeclareAWPContext is not recommended for the sensitive data (user password for example). Indeed, the data flows via the browser. This function must NOT be used to store a user connection for example.
- If two variables are saved with the same name (one in the project and the other one in a page for example), only the first variable will be stored.
- DeclareAWPContext returns False if one of the variables was not restored.
- Only the variables passed to DeclareAWPContext during a page display will be retrieved during the next display. Variables previously passed are not automatically saved again.
- Only simple variables (integer, string, etc.) are supported.
- A multi-file Upload control cannot be used with cookie AWP contexts.
To implement the management of AWP contexts on disk: - Use ConfigureAWPContext to specify the management mode of AWP context. This function should be used in the initialization process of project. Indeed, the selected mode cannot be modified once the session is started.
To use the management of contexts on disk, the following line of code can be used:
ConfigureAWPContext(ctxDisk)
Note The ConfigureAWPContext function can also be used to define the transmission mode of the context identifier. This identifier can be transmitted:- By URL and cookie during the first start, then with the best possible mode (by cookie if cookies are accepted by the browser). This mode is the default mode.
- By cookie only. In this case, the management of cookies must be enabled on the user's browser
- By URL only. In this case, the identifier will always appear in the URL of pages.
- Use DeclareAWPContext to store the desired variables. This function should be used in the project initialization code (for the project variables) and/or in the initialization code of the pages (for page variables). In most cases, this function must be used in the process where the variables are declared and initialized.
Remarks: In this operating mode:- DeclareAWPContext uses the contexts on disk. The values of variables are always restored.
- The total size of values for the different variables is not limited.
- DeclareAWPContext can be used for the sensitive data (user password for example).
- If two variables are saved with the same name (one in the project and the other one in a page for example), the two variables are stored independently.
- DeclareAWPContext returns False if one of the variables was not restored.
- All variables passed to DeclareAWPContext during a page display can be retrieved during the next display. Variables previously passed are automatically saved again.
- Variables of simple type (integer, string, etc.) are managed as well as variables of structure, class, array or associative array type.. Fixed arrays, associative arrays of local structures and global class members are not supported.
- Multi-file Upload control fields can only be used in disk-based AWP contexts.
- To delete a specific variable from the context, you have the ability to use CancelAWPContext.
- IdentifierAWPContext is used to find out the context identifier of Active WEBDEV Page.
Note The WEBDEV administrator can configure the validity period of AWP contexts (option "AWP context duration" in the "Configuration" tab). As soon as the specified duration is exceeded, and if no new request was performed, the context file is deleted. Freeing the context on disk WEBDEV Application Server protege automáticamente cada contexto AWP de los accesos simultáneos: - En cualquier momento, se permite que una sola llamada AWP gestione un contexto AWP determinado.
- Las otras llamadas AWP que quieran manejar este contexto (es decir, las otras llamadas del mismo cliente/navegador) esperan a que termine la primera llamada:
- La llamada Eech puede acceder a los últimos valores.
- El modo de funcionamiento global es equivalente al modo de funcionamiento de las sesiones WEBDEV estándar.
- El contexto AWP se libera automáticamente (para la siguiente llamada) tras la ejecución del último proceso WLanguage.
En algunos casos, este modo de funcionamiento no es óptimo. Por ejemplo, una Página WEBDEV Activa para la descarga de archivos seguirá manteniendo el bloqueo del contexto durante toda la ejecución de FileDisplay. Este bloqueo bloquea las demás llamadas del cliente a la aplicación (descarga de un segundo archivo en paralelo, por ejemplo). En este caso, AWP: Managing contexts indica que el contexto AWP ya no se utilizará, por lo que puede liberarse. WLanguage functions for managing AWP contexts The following WLanguage functions are used to manage AWP contexts:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|