我们应该在正常的 JSF 会话中找到什么?
What should we found in a normal JSF session?
我今天才注意到会话映射包含的内容比我输入的要多。
Map<String, Object> sessionMap = FacesContext.getCurrentInstance().getExternalContext().getSessionMap();
Iterator attributeNames = sessionMap.keySet().iterator();
while ( attributeNames.hasNext() ){
System.out.println(attributeNames.next().toString());
}
我在会话中发现了两个未知对象:com.sun.faces.application.view.activeViewMaps
和 javax.faces.request.charset
。在会话中找到那些对象是否正常?
我问这个是因为 com.sun.faces.application.view.activeViewMaps
在服务器重启时出现序列化错误。看起来它试图序列化几乎所有内容。
注意:我知道我可以通过取消注释服务器 context.xml
文件中的 <Manager pathname="" />
来关闭序列化。我只想知道在session中找到com.sun.faces.application.view.activeViewMaps
是否正常
是的,在会话中找到两者是正常的:
com.sun.faces.application.view.activeViewMaps:
从 JSF 2.2.0 开始,com.sun.faces.application.view.ViewScopeContextManager
处理 CDI @ViewScoped
beans,并以 ACTIVE_VIEW_MAPS
作为键(ACTIVE_VIEW_MAPS
是一个常量字段,其值为 "com.sun.faces.application.view.activeViewMaps"
),以便跟踪它们。
会话被销毁时它们也会被销毁,您可以从grepcode.com.
查看sessionDestroyed(HttpSessionEvent hse)
的源代码
javax.faces.request.charset:
在 JSF 文档中,您可以找到关于方法 public String calculateCharacterEncoding(FacesContext context)
of the ViewHandler
的内容:
Returns the correct character encoding to be used for this request.
The following algorithm is employed.
- Examine the Content-Type request header. If it has a charset parameter, extract it and return that as the encoding.
- If no
charset
parameter was found, check for the existence of a
session by calling ExternalContext.getSession(boolean)
passing false
as the argument. If that method returns true
, get the session Map by
calling ExternalContext.getSessionMap()
and look for a value under the
key given by the value of the symbolic constant
CHARACTER_ENCODING_KEY
. If present, return the value, converted to
String.
- Otherwise, return null
虽然 CHARACTER_ENCODING_KEY
是常量字段:
The key, in the session's attribute set, under which the response
character encoding may be stored and retrieved.
您可以从 here 中获取它的值,即:"javax.faces.request.charset"
我今天才注意到会话映射包含的内容比我输入的要多。
Map<String, Object> sessionMap = FacesContext.getCurrentInstance().getExternalContext().getSessionMap();
Iterator attributeNames = sessionMap.keySet().iterator();
while ( attributeNames.hasNext() ){
System.out.println(attributeNames.next().toString());
}
我在会话中发现了两个未知对象:com.sun.faces.application.view.activeViewMaps
和 javax.faces.request.charset
。在会话中找到那些对象是否正常?
我问这个是因为 com.sun.faces.application.view.activeViewMaps
在服务器重启时出现序列化错误。看起来它试图序列化几乎所有内容。
注意:我知道我可以通过取消注释服务器 context.xml
文件中的 <Manager pathname="" />
来关闭序列化。我只想知道在session中找到com.sun.faces.application.view.activeViewMaps
是否正常
是的,在会话中找到两者是正常的:
com.sun.faces.application.view.activeViewMaps:
从 JSF 2.2.0 开始,com.sun.faces.application.view.ViewScopeContextManager
处理 CDI @ViewScoped
beans,并以 ACTIVE_VIEW_MAPS
作为键(ACTIVE_VIEW_MAPS
是一个常量字段,其值为 "com.sun.faces.application.view.activeViewMaps"
),以便跟踪它们。
会话被销毁时它们也会被销毁,您可以从grepcode.com.
查看sessionDestroyed(HttpSessionEvent hse)
的源代码
javax.faces.request.charset:
在 JSF 文档中,您可以找到关于方法 public String calculateCharacterEncoding(FacesContext context)
of the ViewHandler
的内容:
Returns the correct character encoding to be used for this request.
The following algorithm is employed.
- Examine the Content-Type request header. If it has a charset parameter, extract it and return that as the encoding.
- If no
charset
parameter was found, check for the existence of a session by callingExternalContext.getSession(boolean)
passingfalse
as the argument. If that method returnstrue
, get the session Map by callingExternalContext.getSessionMap()
and look for a value under the key given by the value of the symbolic constantCHARACTER_ENCODING_KEY
. If present, return the value, converted to String.- Otherwise, return null
虽然 CHARACTER_ENCODING_KEY
是常量字段:
The key, in the session's attribute set, under which the response character encoding may be stored and retrieved.
您可以从 here 中获取它的值,即:"javax.faces.request.charset"