21 January 2011

What is org.apache.myfaces.trinidad.CLIENT_STATE_MAX_TOKENS?


According to "Configuring Apache Trinidad" documentation
 In "token"-based client-side state saving, chooses how many tokens should be preserved at any one time. The default value is 15. When this is exceeded, state will have effectively been "forgotten" for the least recently viewed pages, which can impact users that actively use the Back button or that have multiple windows open simultaneously. Developers building HTML applications that rely heavily on frames will likely need to increase this value.

Also there is an nice explanation found on OTN by Simon Lessard
As for client side vs. server side, using Trinidad, there's little difference. But let me do a small recap:

JSF 1.1
server = a single view saved on the server, extremely back button error prone
client = the whole view is saved on the client, increasing network latency by increased request and response size.

JSF 1.2
server = view is Serialized on the server and identified by a token on the client. Efficient and quite back button safe, unless the user click many times on back then the threshold get busted and ViewExpiredException is thrown.
client = the whole view is saved on the client, increasing network latency by increased request and response size.

ADF Faces
server = a single view saved on the server, extremely back button error prone.
client = view is Serialized on the server and identified by a token on the client. Way more efficient than default client saving, but then again there's a threshold like JSF 1.2 server state saving.

Trinidad 1.2.x
server = a single view saved on the server, extremely back button error prone.
client = depends on org.apache.myfaces.trinidad.CLIENT_STATE_METHOD:

org.apache.myfaces.trinidad.CLIENT_STATE_METHOD:
token (default) = same as server side as of JSF 1.2, but you can control the amount of token with org.apache.myfaces.trinidad.CLIENT_STATE_MAX_TOKENS parameter;
all = default client state saving.

Finally, from Appendix A - ADF Faces Configuration of Oracle® Fusion Middleware Web User Interface Developer's Guide for Oracle Application Development Framework 11g Release,
you can see a wider aspect of state saving in ADF
A.2.3.1 State Saving
You can specify the following state-saving context parameters:
  • org.apache.myfaces.trinidad.CLIENT_STATE_METHODSpecifies the type of client-side state saving to use when client-side state saving is enabled by using javax.faces.STATE_SAVING_METHOD. The values for CLIENT_STATE_METHOD are:
    • token: (Default) Stores the page state in the session, but persists a token to the client. The simple token, which identifies a block of state stored back on the HttpSession object, is stored on the client. This enables ADF Faces to disambiguate the same page appearing multiple times. Failover is supported.
    • all: Stores all state information on the client in a (potentially large) hidden form field. It is useful for developers who do not want to use HttpSession.
    Performance Tip:
    Client-side state saving is recommended. However, because of the potential size of storing all state information, it is recommended that you set client-state saving to token.
  • org.apache.myfaces.trinidad.CLIENT_STATE_MAX_TOKENS: Specifies how many tokens should be stored at any one time per user, when token-based client-side state saving is enabled. The default is 15. When the number of tokens is exceeded, the state is lost for the least recently viewed pages, which affects users who actively use the Back button or who have multiple windows opened at the same time. If you are building HTML applications that rely heavily on frames, you would want to increase this value.


No comments:

Post a Comment

You might also like:

Related Posts Plugin for WordPress, Blogger...