Author: nbelaevski
Date: 2008-08-07 20:07:25 -0400 (Thu, 07 Aug 2008)
New Revision: 9982
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/application/AjaxStateManager.java
Log:
https://jira.jboss.org/jira/browse/RF-4108
https://jira.jboss.org/jira/browse/RF-4115
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/application/AjaxStateManager.java
===================================================================
---
trunk/framework/impl/src/main/java/org/ajax4jsf/application/AjaxStateManager.java 2008-08-07
18:52:59 UTC (rev 9981)
+++
trunk/framework/impl/src/main/java/org/ajax4jsf/application/AjaxStateManager.java 2008-08-08
00:07:25 UTC (rev 9982)
@@ -26,6 +26,7 @@
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
+import java.io.ObjectStreamClass;
import java.io.StringWriter;
import java.lang.reflect.Constructor;
import java.util.HashMap;
@@ -303,7 +304,14 @@
if (ContextInitParameters.isSerializeServerState(context)) {
ObjectInputStream ois = null;
try {
- ois = new ObjectInputStream(new ByteArrayInputStream((byte[]) state));
+ ois = new ObjectInputStream(new ByteArrayInputStream((byte[]) state)) {
+ @Override
+ protected Class<?> resolveClass(ObjectStreamClass desc)
+ throws IOException, ClassNotFoundException {
+ return Class.forName(desc.getName(), true,
+ Thread.currentThread().getContextClassLoader());
+ }
+ };
return ois.readObject();
} catch (Exception e) {
throw new FacesException(e);
@@ -385,14 +393,21 @@
if (isSavingStateInClient(context)) {
serializedView = (Object[]) responseStateManager.getState(context,
viewId);
+
+ if (null != serializedView) {
+ treeStructure = (TreeStructureNode) serializedView[0];
+ state = (Object[]) serializedView[1];
+ }
} else {
serializedView = restoreStateFromSession(context, viewId,
renderKitId);
+
+ if (null != serializedView) {
+ treeStructure = (TreeStructureNode) serializedView[0];
+ state = (Object[]) handleRestoreState(context, serializedView[1]);
+ }
}
- if (null != serializedView) {
- treeStructure = (TreeStructureNode) serializedView[0];
- state = (Object[]) handleRestoreState(context, serializedView[1]);
- }
+
if (null != treeStructure) {
viewRoot = (UIViewRoot) treeStructure.restore(componentLoader);
if (null != viewRoot && null != state) {