Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Sling Filters with cookies

anelem1760873
Level 4
Level 4

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.

1 Accepted Solution
Gaurav-Behl
Correct answer by
Community Advisor
Community Advisor

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

View solution in original post

1 Reply
Gaurav-Behl
Correct answer by
Community Advisor
Community Advisor

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

View solution in original post