PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Overview
  • How to proceed?
  • To implement the management of AWP contexts via cookies:
  • To implement the management of AWP contexts on disk:
  • WLanguage functions for managing the AWP contexts
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Overview
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:
  • Managing the contexts via cookies: the value of the different variables is stored on the browser of the user via 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.
  • Managing the contexts on disk: the value of the different variables is 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 the stored data.
Versions 17 and later
Note: If several AWP contexts are found on the same domain, these contexts are entirely independent. The identifier of the AWP context is unique per domain and per site.
New in version 17
Note: If several AWP contexts are found on the same domain, these contexts are entirely independent. The identifier of the AWP context is unique per domain and per site.
Note: If several AWP contexts are found on the same domain, these contexts are entirely independent. The identifier of the AWP context is unique per domain and per site.
How to proceed?

To implement the management of AWP contexts via cookies:

  1. 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 code line can be used:
    ConfigureAWPContext(ctxCookie)
  2. Use DeclareAWPContext to store/retrieve the value of requested variables. This function should be used in the initialization code of project (for the project variables) and/or in the initialization code of pages (for the page variables). In most cases, this function must be used in the process where the variables are declared and initialized.
Notes: In this operating mode:
  • DeclareAWPContext is using 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. The variables that were previously passed are not automatically saved again.
  • Only the simple variables (integer, string, ...) are supported.
  • A multi-file Upload control cannot be used with the AWP contexts whose type is cookie.

To implement the management of AWP contexts on disk:

  1. 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 code line can be used:
    ConfigureAWPContext(ctxDisk)

    Note: ConfigureAWPContext can also be used to define the transmission mode of 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 browser of Web user.
    • By URL only. In this case, the identifier will always appear in the URL of pages.
  2. Use DeclareAWPContext to store the requested variables. This function should be used in the initialization code of project (for the project variables) and/or in the initialization code of pages (for the page variables). In most cases, this function must be used in the process where the variables are declared and initialized.
    Notes: In this operating mode:
    • DeclareAWPContext is using the contexts on disk. The values of variables are always restored.
    • The total size of values for the different variables is not limited.
    • The DeclareAWPContext function 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 the variables passed to DeclareAWPContext during a page display can be retrieved during the next display. The variables that were passed beforehand are automatically saved again.
    • The simple variables (integer, string, ...) are supported as well as the structure, class, array or associative array variables. The fixed arrays, the associative arrays of local structures and the global members of classes are not supported.
    • The multi-file Upload controls can only be used with the AWP contexts on disk.
  3. To delete a specific variable from the context, you have the ability to use CancelAWPContext.
  4. IdentifierAWPContext is used to find out the context identifier of AWP page.
Note: The WEBDEV administrator allows you to configure the duration for the validity of AWP contexts ("Duration of AWP contexts" in the "Configuration" tab). As soon as the specified duration is exceeded, and if no new request was performed, the context file is deleted.
Versions 18 and later
Freeing the context on disk
The WEBDEV Application Server automatically protects each AWP context from the concurrent accesses :
  • At any time, a single AWP call is allowed to handle a given AWP context.
  • The other AWP calls that want to handle this context (which means the other calls from the same client/browser) wait for the first call to be over:
    • Eech call can access the last values.
    • The global operating mode is equivalent to the operating mode of standard WEBDEV sessions.
  • The AWP context is automatically freed (for the next call) after the execution of the last WLanguage process.
In some cases, this operating mode is not optimum.
For example, an AWP page for file download will continue to maintain the lock on the context during the entire execution of FileDisplay. This lock locks the other calls of the client to the application (downloading a second file in parallel for example).
In this case, FreeAWPContext allows you to specify that the AWP context will not be used anymore and it is used to free it.
New in version 18
Freeing the context on disk
The WEBDEV Application Server automatically protects each AWP context from the concurrent accesses :
  • At any time, a single AWP call is allowed to handle a given AWP context.
  • The other AWP calls that want to handle this context (which means the other calls from the same client/browser) wait for the first call to be over:
    • Eech call can access the last values.
    • The global operating mode is equivalent to the operating mode of standard WEBDEV sessions.
  • The AWP context is automatically freed (for the next call) after the execution of the last WLanguage process.
In some cases, this operating mode is not optimum.
For example, an AWP page for file download will continue to maintain the lock on the context during the entire execution of FileDisplay. This lock locks the other calls of the client to the application (downloading a second file in parallel for example).
In this case, FreeAWPContext allows you to specify that the AWP context will not be used anymore and it is used to free it.
Freeing the context on disk
The WEBDEV Application Server automatically protects each AWP context from the concurrent accesses :
  • At any time, a single AWP call is allowed to handle a given AWP context.
  • The other AWP calls that want to handle this context (which means the other calls from the same client/browser) wait for the first call to be over:
    • Eech call can access the last values.
    • The global operating mode is equivalent to the operating mode of standard WEBDEV sessions.
  • The AWP context is automatically freed (for the next call) after the execution of the last WLanguage process.
In some cases, this operating mode is not optimum.
For example, an AWP page for file download will continue to maintain the lock on the context during the entire execution of FileDisplay. This lock locks the other calls of the client to the application (downloading a second file in parallel for example).
In this case, FreeAWPContext allows you to specify that the AWP context will not be used anymore and it is used to free it.
WLanguage functions for managing the AWP contexts
The following WLanguage functions are used to manage the AWP contexts:
Versions 12 and later
CancelAWPContext
New in version 12
CancelAWPContext
CancelAWPContext
Deletes from the AWP context a variable that was added by DeclareAWPContext.
Versions 12 and later
ConfigureAWPContext
New in version 12
ConfigureAWPContext
ConfigureAWPContext
Configures the operating mode of AWP context.
Versions 10 and later
DeclareAWPContext
New in version 10
DeclareAWPContext
DeclareAWPContext
Used to declare a list of variables whose value will be persistent between the successive displays of AWP pages.
Versions 18 and later
FreeAWPContext
New in version 18
FreeAWPContext
FreeAWPContext
Frees the AWP context in advance (on disk) to allow the other call on the same AWP context to be processed in parallel.
Versions 12 and later
IdentifierAWPContext
New in version 12
IdentifierAWPContext
IdentifierAWPContext
Returns the identifier of AWP context.
Minimum required version
  • Version 12
Comments
Click [Add] to post a comment