Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

How to adapt response object in slingmodel?

Avatar

Level 2

I need to get and set some values in cookie inside the slingModel. I am currently adapting this to SlingHttpServletRequest. Is there any way to inject SlingHttpServletResponse inside the current slingModel.

3 Replies

Avatar

Administrator

Duplicate question:-



Kautuk Sahni

Avatar

Level 10

See Praveen code in the thread that Kautuk pointed you to.

In that code snippet they are using only SlingHttpServletRequest  object and is adapted to the SlingHttpServletRequest class.

In my case I need to use both SlingHttpServletRequest and SlingHttpResponse object.

For getting cookie value I'll use the below code

request.setCookie() [SlingHttpServletRequest]

For setting cookie I need to use the below code

response.setCookie() [SlingHttpResponse]

My question is how can I get both the objects in the same slingModel