What does jftfdi jffi do for my query string?

We use JavaServer Faces 2.2 (Mojarra 2.2.1) in our project. I noticed something strange. On a page called reporting.xhtml , where I use f:metadata with the new f:viewAction my browser, Safari in this case displays the following query line:

 reporting.jsf?jftfdi=&jffi=reporting%3Ffaces-redirect%3Dtrue 

What kind of magic is this? What are the jftfdi and jiffi options? What is their purpose?

+7
jsf jsf-2
source share
1 answer

This is part of the new JSF 2.2 feature described in issue 949 specification. Basically, it allows JSF to identify the client window. It is basically the same as cid in CDI @ConversationScoped and windowId in CODI @ViewScoped / @ViewAccessScoped . This client window identifier, in turn, is used, among other things, by the new JSF 2.2 @FlowScoped , as described in spec issue 730 .

"What's new in JSF 2.2?" An article by my colleague Arjan Tijms explains the need quite clearly:

Lifecycle

Identification of client windows through window identifier

Perhaps one of the biggest problems facing the development of web applications since its inception is the inability to distinguish between requests coming from different windows of the same browser. Not only was the actual solution long overdue, it took a long time to realize that this was even a problem.

The root of the problem, as always, is that the HTTP protocol is essentially stateless, while applications are not at all. However, there is the concept of a cookie, which is overwhelmingly a mechanism used to distinguish between requests from different users and to implement such things as the session area, which in turn is the basis of most of the login mechanisms.

Although a cookie does work for this, its global for every browser and domain. If a user opens several tabs or windows for one domain, then requests from them will send the same cookie to the server. Thus, logging in as a different user in a different window for the same website is usually not possible, and because of this, there can also be problems with workflows (including callbacks, navigation) in different windows.

There are various solutions in JSF that are somehow related to this. The viewport effectively implements a session for each window, as long as the user remains on one page and performs only feedback. Flash is used to transfer data between different pages (presumably in the same window) when navigating through Redirect / GET. Theres a wide range of areas implemented by third parties that do something similar.

All of them have some implicit concept or assumption about the concept of a "client window", but there is no explicit API for this.

JSF 2.2 will introduce support for two different aspects of this:

  • Single Window Identification: Client Window Identifier
  • API and window concept life cycle understanding.

Obviously, you have configured the application as such.

See also:

+9
source share

All Articles