English 中文(简体)
如何清除所有网页 来自会议的流体图?
原标题:How to clear all pageFlowScope maps from session?

• 如何清除网页 当我们确信不再需要时,从届会中流出的范围和观点?

在目前申请情况下的“FlowScope地图”号之后

    RequestContext requestContext = RequestContext.getCurrentInstance();
    requestContext.getPageFlowScope().clear();

但是,如果我放弃<代码>,则 本届会议仍然有<代码>PageFlowcops的许多事例。

org.apache.myfaces.trinidadinternal.application.PageFlowScope.ois6p8lk1 
org.apache.myfaces.trinidadinternal.application.PageFlowScope.ois6p8lk2 
org.apache.myfaces.trinidadinternal.application.PageFlowScope.ois6p8lk3 

以及

org.apache.myfaces.trinidadinternal.application.VIEW_CACHE.1qvzgdgkw
org.apache.myfaces.trinidadinternal.application.VIEW_CACHE.2qvzgdgkw
org.apache.myfaces.trinidadinternal.application.VIEW_CACHE.3qvzgdgkw

显然,如果我明确届会的属性的话,那么大家都会走下去,但我不想这样做,是否还有其他办法?

使用

  • trinidad-api-1.0.10.jar
  • myfaces-impl-1.1.5.jar

http://www.ohchr.org。

Also observed following attribute is kept in session forever, and the content grows over time

org.apache.myfaces.trinidadinternal.Change
最佳回答

<>PageFlowScope>

If not planning to use multiple pageflowscopes following entry in trinidad-config.xml can be altered

<page-flow-scope-lifetime>1</page-flow-scope-lifetime>

这将控制org.apache.myfaces.trinidadinternal.application.PageFlowScope 。 页: 1


VIEW_CACHE

如不计划使用<代码>VIEW_HE,init params,载于web.xml 可以归入最低值。

<context-param>
    <param-name>org.apache.myfaces.trinidad.CLIENT_STATE_MAX_TOKENS</param-name>
    <param-value>1</param-value>
</context-param>    

<context-param>
    <param-name>
        org.apache.myfaces.NUMBER_OF_VIEWS_IN_SESSION
    </param-name>
    <param-value>1</param-value>
</context-param>

This will keep control over number of org.apache.myfaces.trinidadinternal.application.VIEW_CACHE kept in session


trinidadinternal.Change

我找不到避免这种情况的办法。


采用以下方法进行清理

@SuppressWarnings("unchecked")
public static Map<String, Object> getSessionMap() {
    FacesContext context = FacesContext.getCurrentInstance();
    return context.getExternalContext().getSessionMap();
}


private void clearMyfacesSessionAttributes() {
    RequestContext requestContext = RequestContext.getCurrentInstance();
    requestContext.getPageFlowScope().clear();
    Map<String, Object> sessionMap = getSessionMap();
    Set<Map.Entry<String, Object>> entrySet = sessionMap.entrySet();
    for (Map.Entry<String, Object> entry : entrySet) {
        String key = entry.getKey();
        if(key.contains("org.apache.myfaces.trinidadinternal.application.VIEW_CACHE")
                || key.contains("org.apache.myfaces.trinidadinternal.application.PageFlowScope")
                || key.contains("org.apache.myfaces.trinidadinternal.Change"))
        {
            sessionMap.remove(key);
        }
    }
}
问题回答

暂无回答




相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签