Sling Filters with cookies | Community
Skip to main content
anelem1760873
New Participant
February 26, 2019
Solved

Sling Filters with cookies

  • February 26, 2019
  • 1 reply
  • 1544 views

Hi Guys,

I am trying to open an asset or a page in AEM based on if the the cookie is available for that specific Asset or Page. if the cookie is available access must granted else redirect to a form. The cookie will be created on submission of the form. Can you guys give me a direction on how should I go about doing this.

Thanks.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Gaurav-Behl

I'm not sure that you're creating the cookie or client side (js/jquery) or server side (java).

Based on that design approach, you could simply redirect the request in either js using window.location(path) or response.sendRedirect(path), response.setStatus(301) and response.setHeader("Location",path)

you should check for the cookie existence and do the redirect in client side to avoid access to content in case it is cached in dispatcher.

you may have to do the same in both places based on the flow of request and number of entry points for your use case.

HTH

1 reply

Gaurav-Behl
Gaurav-BehlAccepted solution
New Participant
February 26, 2019

I'm not sure that you're creating the cookie or client side (js/jquery) or server side (java).

Based on that design approach, you could simply redirect the request in either js using window.location(path) or response.sendRedirect(path), response.setStatus(301) and response.setHeader("Location",path)

you should check for the cookie existence and do the redirect in client side to avoid access to content in case it is cached in dispatcher.

you may have to do the same in both places based on the flow of request and number of entry points for your use case.

HTH