Skip to content

Commit

Permalink
Merge #762 remote-tracking branch 'origin/2.x' into 3.x
Browse files Browse the repository at this point in the history
  • Loading branch information
BalusC committed Jun 17, 2023
2 parents 75a8b0c + 4b2edb7 commit e83962e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/java/org/omnifaces/util/Hacks.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import static org.omnifaces.util.FacesLocal.getSessionAttribute;
import static org.omnifaces.util.FacesLocal.isAjaxRequest;
import static org.omnifaces.util.FacesLocal.isRenderResponse;
import static org.omnifaces.util.FacesLocal.normalizeViewId;
import static org.omnifaces.util.Reflection.accessField;
import static org.omnifaces.util.Reflection.invokeMethod;
import static org.omnifaces.util.Reflection.toClassOrNull;
Expand Down Expand Up @@ -263,7 +264,7 @@ public static void removeViewState(FacesContext context, ResponseStateManager ma

Object stateCache = invokeMethod(manager, "getStateCache", context);
Object stateId = invokeMethod(stateCache, "getServerStateId", context, state);
Serializable key = invokeMethod(invokeMethod(stateCache, "getSessionViewStorageFactory"), "createSerializedViewKey", context, viewId, stateId);
Serializable key = invokeMethod(invokeMethod(stateCache, "getSessionViewStorageFactory"), "createSerializedViewKey", context, normalizeViewId(context, viewId), stateId);

List<Serializable> keys = accessField(viewCollection, "_keys");
Map<Serializable, Object> serializedViews = accessField(viewCollection, "_serializedViews");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,4 +209,10 @@ public void destroyViewState() {
assertEquals("unload submit", messages.getText()); // Unload was from previous tab.
}

@Test @InSequence(4)
public void destroyViewStateWithJsfMapping() {
open("ViewScopedIT.jsf");
destroyViewState();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,6 @@
<servlet-mapping>
<servlet-name>facesServlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
</web-app>

0 comments on commit e83962e

Please sign in to comment.