jftfdi jffi对我的查询字符串做了什么? [英] What are jftfdi jffi doing to my query string?

查看:102
本文介绍了jftfdi jffi对我的查询字符串做了什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在项目中使用JavaServer Faces 2.2(Mojarra 2.2.1).我发现有些奇怪.在名为reporting.xhtml的页面上,在其中我将f:metadata与新的f:viewAction结合使用的浏览器中,本例中的Safari显示以下查询字符串:

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

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

这是什么巫术? jftfdi和jiffi的参数是什么?他们的目的是什么?

What wizardry is this? What are the parameters jftfdi and jiffi doing? What is their purpose?

推荐答案

它是新的JSF 2.2功能的一部分,如规范 issue 949 .基本上,它使JSF能够识别客户机窗口.它基本上与CDI的@ConversationScoped中的cid和CODI的@ViewScoped/@ViewAccessScoped中的windowId相同.该客户端窗口ID依次由规范 issue 730 描述的新JSF 2.2 @FlowScoped范围使用. >.

It's part of the new JSF 2.2 feature as described by spec issue 949. Basically, it enables JSF to identify the client window. It's basically the same as cid in CDI's @ConversationScoped and windowId in CODI's @ViewScoped/@ViewAccessScoped. This client window ID is in turn used by among others the new JSF 2.2 @FlowScoped scope as described by spec issue 730.

"JSF 2.2的新功能?"我的同事Arjan Tijms的文章很清楚地解释了这一需求:

The "What's new in JSF 2.2?" article of my fellow Arjan Tijms explains the need pretty clearly:

生命周期

通过窗口ID识别客户端窗口

可以说,自Web应用程序开发以来一直困扰着Web应用程序开发的最大问题之一是无法区分源自单个浏览器的不同窗口的请求.实际的解决方案不仅早该逾期,而且花了很长时间才意识到这是一个问题.

LifeCycle

Identify client windows via a Window Id

Arguably one of the biggest problems that has been plaguing web application development since its inception is the inability to distinguish requests originating from different windows of a single browser. Not only has an actual solution been long overdue, it has taken a long time to realize this even was a problem.

与以往一样,问题的根源在于HTTP协议本质上是无状态的,而应用程序通常不是.不过,这里有一个cookie的概念,它是一种压倒性的机制,用于区分来自不同用户的请求并用于实现会话范围之类的东西,而会话范围又是大部分登录机制所基于的.

The root of the problem, as always, is that the HTTP protocol is inherently stateless while applications in general are not. There is the concept of a cookie though, which is overwhelmingly the mechanism used to distinguish requests from different users and to implement things like a session scope where on its turn the bulk of login mechanisms are based on.

虽然Cookie可以解决此问题,但它在每个浏览器和域中都是全局的.如果用户为同一域打开多个选项卡或窗口,则来自这些选项卡或窗口的请求都将向服务器发送相同的cookie.因此,通常不可能在同一网站的不同窗口中以其他用户身份登录,因此,在不同窗口中进行工作流(涉及回发,导航)也可能会很麻烦.

While a cookie does work for this, it’s global per browser and domain. If a user opens multiple tabs or windows for the same domain then requests from those will all send the same cookie to the server. Logging in as a different user in a different window for the same website is thus not normally possible, and having workflows (involving post-backs, navigation) in different windows can also be troublesome because of this.

在JSF中,有各种与此相关的解决方案.只要用户停留在同一页面上并且仅进行回发,视图范围就可以有效地实现每个窗口的会话.当通过重定向/GET完成导航时,Flash用于在不同页面之间(大概在同一窗口内)传输数据.第三方执行的范围很广,可以做类似的事情.

In JSF there are various solutions that are somehow related to this. The view scope effectively implements a session per window as long as the user stays on the same page and does only post-backs. The Flash is used for transferring data between different pages (presumably within the same window) when navigation is done via Redirect/GET. There’s a wide variety of scopes implemented by third parties that do something similar.

所有这些都对客户端窗口"的概念有一些隐含的概念或假设,但是对此没有明确的API.

All of these have some implicit notion or assumption of the concept of a ‘client window’, but there is no explicit API for this.

JSF 2.2将引入对此两个不同方面的支持:

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

  • 单个窗口的标识:客户端窗口ID
  • 窗口概念的API和生命周期意识

很明显,您已经如此配置了应用程序.

Apparently you've configured your application as such.

  • What's new in JSF 2.2? - Lifecycle - Identify client windows via window Id
  • What's new in JSF 2.2? - Navigation - Faces Flow

这篇关于jftfdi jffi对我的查询字符串做了什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆