cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Is OCC v2 really stateless?

stefanweis
Participant
0 Kudos
1,439

Hi everybody,

I'm currently looking at the SAP Commerce OCCv v2 API, which is declared to be stateless. If I want to to an addToCart for example (CartsController::createCartEntry -> addCartEntryInternal), I see that the Controller uses the bean commerceWebServicesCartFacade2 for this operation. But this bean, in the end, is not retrieving the cart by the given cartID from the OCC API, instead it is retrieving the cart by doing getCartService().getSessionCart().

I would have expected that the commerceWebServicesCartFacade2 is not handling anything regarding to a session. Can someone help me with that?

Thank you in advance!

View Entire Topic
neilhp
Product and Topic Expert
Product and Topic Expert

At the request level, OCC v2 is stateless. For example there is no use of the JSESSIONID cookie and so no session that ties together different request.

However internal to the request there is a filter that creates a local session for the duration of the request. That is done because many of the internal services expect data in the session context (for historical reasons, such as support for the accelerators) & so it needs to be populated for correct functioning of the system. In this OCC setup however, you can think of the local session as logically having request scope only.

stefanweis
Participant
0 Kudos

Ok, thank you. So I don't have to worry about keeping the state/session on client side, as the "per request session" ist automatically build by Filters on every request?

neilhp
Product and Topic Expert
Product and Topic Expert

Correct. And this is why OCC v2 is described as stateless