I want to delete a cookie USERID in my liferay custom theme free marker templete
i am using liferay DXP
I tried this code
<#if !is_signed_in>
<#assign aCK=objectUtil("com.liferay.portal.kernel.util.CookieKeys") />
<#assign userID = aCK.getCookie(request,"USERID") />
<#assign VOID=aCK.deleteCookies(request, response,aCK.getDomain(request), "USERID") />
</#if>
</#if>
but give me null pointer exception becuase of i have null response !
can someone help me to try to do this ?
update:my main purpose is to delete specific cookie "USERID" when:
a-the user logout
b-the session timeout
for(a) i have done the first part by implementing logoutPostAction hook (because logout action don't clear cookies so i need to do this manually)
for (b) i tried to implement sessionDestroyAction hook but i don't have request and response to delete cookies only httpSession
so i turned to the solution of deleting cookies when the session timeout redirect me to the login page or home page so trying to do this in my custom theme .
i hope this update is clear to describe my problem, and try to help me how to solve my problem ?