Package springboot.bg.harisauto.cart
Class CartView
java.lang.Object
springboot.bg.harisauto.cart.CartView
CartView.java - Immutable snapshot of a
ShoppingCart, safe to render.
The cart itself is a session-scoped proxy. Touching it from a template can force the container to create an HTTP session part-way through rendering, which fails once the response has been committed and truncates the page. Reading the cart into this snapshot inside the controller keeps that work before the response is written.
- Author:
- Kristian Popov
-
Method Details
-
of
Takes a snapshot of the given cart.- Parameters:
cart- The session-scoped cart.- Returns:
- A detached view of its contents.
-
getItems
-
getCount
public int getCount() -
getTotal
-