Highlighted

How to adapt response object in slingmodel?

adarshm65812616

07-03-2018

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.

Replies

Highlighted

adarshm65812616

07-03-2018

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