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.
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.