[ 
https://issues.apache.org/jira/browse/MYFACES-1701?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Martin Marinschek updated MYFACES-1701:
---------------------------------------

       Resolution: Fixed
    Fix Version/s: 1.2.1-SNAPSHOT
           Status: Resolved  (was: Patch Available)

Another good catch. There we talk about performance, and then we do this ;)

regards,

Martin

> The state gets reconstructed twice.
> -----------------------------------
>
>                 Key: MYFACES-1701
>                 URL: https://issues.apache.org/jira/browse/MYFACES-1701
>             Project: MyFaces Core
>          Issue Type: Bug
>    Affects Versions: 1.2.1-SNAPSHOT
>            Reporter: Bernhard Huemer
>            Assignee: Martin Marinschek
>             Fix For: 1.2.1-SNAPSHOT
>
>         Attachments: MYFACES-1701.patch, tests.zip
>
>
> As the topic suggests, the state gets reconstructed twice during the Restore 
> View phase. State reconstruction consists of decoding, decrypting and 
> decompressing (assuming that MyFaces has been configured to do so) the given 
> state (i.e. the "javax.faces.ViewState" request parameter) so it shouldn't be 
> done more often than necessary. For a better understanding of this issue, 
> I'll describe the call hierarchy (simplified):
> ///
> // 
> myfaces/core/branches/1_2_1/impl/org/apache/myfaces/application/jsp/JspStateManagerImpl.java
> public UIViewRoot restoreView(FacesContext context, String viewId, String 
> renderKitId) {
>     ...
>     if (isSavingStateInClient(context)) {
>         ...
>         state = responseStateManager.getState(context, viewId);
>     }
>     ...
> }
> // 
> myfaces/core/branches/1_2_1/api/javax/faces/render/ResponseStateManager.java
> public Object getState(FacesContext context, String viewId) {
>     Object[] structureAndState = new Object[2];
>     structureAndState[0] = getTreeStructureToRestore(context, viewId);
>     structureAndState[1] = getComponentStateToRestore(context);
>     return structureAndState;
> }
> // 
> myfaces/core/branches/1_2_1/impl/org/apache/myfaces/renderkit/html/HtmlResponseStateManager.java
> public Object getTreeStructureToRestore(FacesContext facesContext, String 
> viewId) {
>     ...
>     Object encodedState = requestParameterMap.get("javax.faces.ViewState"); 
>     Object[] savedState = (Object[]) StateUtils.reconstruct((String) 
> encodedState, ...);
>     ...
>     return savedState[TREE_PARAM];
> }
> public Object getComponentStateToRestore(FacesContext facesContext) {
>     ...
>     Object encodedState = requestParameterMap.get("javax.faces.ViewState"); 
>     Object[] savedState = (Object[]) StateUtils.reconstruct((String) 
> encodedState, ...);
>     ...
>     return savedState[STATE_PARAM];
> }
> \\\
> One possible solution (without breaking backward compatibility) is to 
> override javax.faces.render.ResponseStateManager#getState(FacesContext, 
> String) and that's exactly what I've done. I've tested my patch with the 
> MyFaces Tomahawk examples on my notebook (Ubuntu 7.04, AMD Turion 1.80 GHz, 
> 1.5 GB DDR). Additionally, I'll attach a Apache JMeter test configuration and 
> results of this test using a local Jetty server. I'd appreciate someone 
> backing up my test results.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to