@Path(value="/")
@Consumes(value={"application/json","application/text","text/html","application/x-www-form-urlencoded"})
@Produces(value="application/json;charset=utf-8")
public class WicketEcomUserContextUpdateService<U extends User>
extends UserUpdateService<User>
User that allows updating of User cart, context etc.ContextualSession.setPartialContext(Object). This gives the programmer to override the mthod to support
partial context updates across Web Service calls.
updateContext(HttpServletRequest, String) and updateContextParam(HttpServletRequest, String, String) call ContextualSession.setContext(Object)
to override all existing contextual data.
TODO: Abstract out non-Wicket related stuff to an abstract classuserService, userTransformerapplicationContext, CACHE, NO_CACHE, request, response| Constructor and Description |
|---|
WicketEcomUserContextUpdateService() |
WicketEcomUserContextUpdateService(boolean checkAuthFiltered) |
| Modifier and Type | Method and Description |
|---|---|
void |
clearCart(javax.servlet.http.HttpServletRequest request,
String cartUserId,
String cartSessionId,
String cartType,
String context)
Clear all existing Cart products on server; the Cart object will stil exist but the list is made empty.
|
Cart |
getCart(javax.servlet.http.HttpServletRequest request,
String cartType)
Fetch the
Cart for a user |
CartService |
getCartService() |
Object |
getContext(javax.servlet.http.HttpServletRequest request) |
Class |
getContextType()
The type of context maintained by the
ContextualSession.getContext() |
<P extends Product> |
getProductsInCart(javax.servlet.http.HttpServletRequest request,
String cartType) |
Map<String,Object> |
getPropertiesInCart(javax.servlet.http.HttpServletRequest request,
String cartType) |
void |
insertCart(javax.servlet.http.HttpServletRequest request,
String cartUserId,
String cartSessionId,
String productNames,
String currency,
String cartType,
String context,
String properties)
Insert cart to server; will replace existing cart items in Session with params supplied
|
void |
removeFromCart(javax.servlet.http.HttpServletRequest request,
String cartUserId,
String cartSessionId,
String productNames,
String cartType,
String context)
Remove specified products names from Cart
|
void |
setCartService(CartService cartService) |
void |
setContextType(Class contextType)
The type of context maintained by the
ContextualSession.getContext() |
void |
updateCart(javax.servlet.http.HttpServletRequest request,
String cartUserId,
String cartSessionId,
String productNames,
String currency,
String cartType,
String context,
String properties)
Update cart for User; will Append products sent from server to existing Session Cart
|
void |
updateContext(javax.servlet.http.HttpServletRequest request,
String context)
Update context.
|
void |
updateContextParam(javax.servlet.http.HttpServletRequest request,
String param,
String value)
A convenience service to Update context param.
|
getUserService, getUserTransformer, setUserService, setUserTransformercheckAuthFilterInvoked, filter, queryfilter, getCacheDef, getTestString, querypublic WicketEcomUserContextUpdateService()
public WicketEcomUserContextUpdateService(boolean checkAuthFiltered)
@POST
@Path(value="updateCart")
public void updateCart(@Context
javax.servlet.http.HttpServletRequest request,
@FormParam(value="cartUserId")
String cartUserId,
@FormParam(value="cartSessionId")
String cartSessionId,
@FormParam(value="productNames")
String productNames,
@FormParam(value="currency")
String currency,
@FormParam(value="cartType")
String cartType,
@FormParam(value="context")
String context,
@FormParam(value="properties")
String properties)
throws Exception
request - as HttpServletRequestcartUserName - as String (User Id or Session Id)productNames - as String, representing Comma separated List of Product.getName()currency - as String @nullable true. A null implies default currencycartType - of Cartcontext - as String; Additional data to set into the session. Example JSON {userId:"xxxxxxxx@xxxxxxxxxx",couponCode:"yyyyyyyyyyyyy"}. The context supplied depends on the Application. @nullable trueproperties - as String (Map of product name and JSON list of properties)ExceptionAbstractCartForm,
script pages lile updateSessionFromCart for Form based alternative@POST
@Path(value="insertCart")
public void insertCart(@Context
javax.servlet.http.HttpServletRequest request,
@FormParam(value="cartUserId")
String cartUserId,
@FormParam(value="cartSessionId")
String cartSessionId,
@FormParam(value="productNames")
String productNames,
@FormParam(value="currency")
String currency,
@FormParam(value="cartType")
String cartType,
@FormParam(value="context")
String context,
@FormParam(value="properties")
String properties)
throws Exception
request - as HttpServletRequestcartUserName - as String (User Id or Session Id)productNames - as String, representing Comma separated List of Product.getName()currency - as String @nullable true. A null implies default currencycartType - of Cartcontext - as String; Additional data to set into the session. Example JSON {userId:"xxxxxxxx@xxxxxxxxxx",couponCode:"yyyyyyyyyyyyy"}. The context supplied depends on the Application. @nullable trueExceptionAbstractCartForm,
script pages lile updateSessionFromCart for Form based alternative@POST
@Path(value="removeFromCart")
public void removeFromCart(@Context
javax.servlet.http.HttpServletRequest request,
@FormParam(value="cartUserId")
String cartUserId,
@FormParam(value="cartSessionId")
String cartSessionId,
@FormParam(value="productNames")
String productNames,
@FormParam(value="cartType")
String cartType,
@FormParam(value="context")
String context)
throws Exception
request - as HttpServletRequestcartUserName - as String (User Id or Session Id)productNames - as String, representing Comma separated List of Product.getName()cartType - of Cartcontext - as String; Additional data to set into the session. Example JSON {userId:"xxxxxxxx@xxxxxxxxxx",couponCode:"yyyyyyyyyyyyy"}. The context supplied depends on the Application. @nullable trueExceptionAbstractCartForm,
script pages lile updateSessionFromCart for Form based alternative@POST
@Path(value="clearCart")
public void clearCart(@Context
javax.servlet.http.HttpServletRequest request,
@FormParam(value="cartUserId")
String cartUserId,
@FormParam(value="cartSessionId")
String cartSessionId,
@FormParam(value="cartType")
String cartType,
@FormParam(value="context")
String context)
throws Exception
request - as HttpServletRequestcartUserName - as String (User Id or Session Id)cartType - of Cartcontext - as String; Additional data to set into the session. Example JSON {userId:"xxxxxxxx@xxxxxxxxxx",couponCode:"yyyyyyyyyyyyy"}. The context supplied depends on the Application. @nullable trueExceptionAbstractCartForm,
script pages lile updateSessionFromCart for Form based alternative@GET
@Path(value="updateContext")
public void updateContext(@Context
javax.servlet.http.HttpServletRequest request,
@FormParam(value="context")
String context)
throws Exception
Strategys, where additional context is required at times for Promotions, Codes etc.request - context - Exception@GET @Path(value="getContext") public Object getContext(@Context javax.servlet.http.HttpServletRequest request) throws Exception
Exception@GET
@Path(value="updateContextParam")
public void updateContextParam(@Context
javax.servlet.http.HttpServletRequest request,
@QueryParam(value="param")
String param,
@QueryParam(value="value")
String value)
throws Exception
ContextualSession.setPartialContext(Object) and use updateContext(HttpServletRequest, String)
straight.request - as HttpServletRequestparam - as Stringvalue - as StringExceptionEComSession#setPartialContext(Object)}@GET @Path(value="cart") public Cart getCart(@Context javax.servlet.http.HttpServletRequest request, @QueryParam(value="cartType") String cartType) throws Exception
Cart for a user@GET @Path(value="productsInCart") public <P extends Product> List<P> getProductsInCart(@Context javax.servlet.http.HttpServletRequest request, @QueryParam(value="cartType") String cartType) throws Exception
Exception@GET @Path(value="propertiesInCart") public Map<String,Object> getPropertiesInCart(@Context javax.servlet.http.HttpServletRequest request, @QueryParam(value="cartType") String cartType) throws Exception
Exceptionpublic CartService getCartService()
public void setCartService(CartService cartService)
public Class getContextType()
ContextualSession.getContext()Object.getClass() (String as JSON. The literal CONTEXT type would be a String; but this type signifies that it should be treated as JSON)public void setContextType(Class contextType)
ContextualSession.getContext()Object.getClass() (String as JSON. The literal CONTEXT type would be a String; but this type signifies that it should be treated as JSON)Copyright © 2018. All rights reserved.