Details
Description
Currently we have the following order of filters (in web.xml)
1. ShoppingCartResolverFilter - which gets cart object from cookies (but cart is not aware of the Shop, so we cannot set defaults for currency and shop id)
2. ShopResolverFilter - which sets the Shop object in ApplicationDirector and also sets defaults to the cart (which is set by previous filter).
Therefore there is a bit of circular dependency here.
What we need to do is:
1. Fix the order so that the ShopResolverFilter is triggered first BUT DOES NOT set defaults to cart (this code should be moved to ShoppingCartResolverFilter once it restores the cart object). This can be achieved by re-ordering <filter-mapping> in web.xml
2. Move the setting of defaults to ShoppingCartResolverFilter
This will remove the cyclic dependency between filters and refine the responsibility of each filter.