Hi All,
I am having problems of trying to set a session cookie(s) in Liferay 6.0 portlets. I want to be able to set a cookie to the client browser to store application key for the linkedin authentication, where it can be then retrieved by other portlets.
I am able to read cookies by using a following:
public void addLinkedInCV(ActionRequest request, ActionResponse response) throws PortalException, SystemException { HttpServletRequest convertReq = PortalUtil .getHttpServletRequest(request); Cookie[] cookies = convertReq.getCookies(); ...
Here's my failed attempt to read one.
@Override public void doView(RenderRequest renderRequest,RenderResponse renderResponse) throws IOException, PortletException { HttpServletResponse convertRes = PortalUtil.getHttpServletResponse(renderResponse); HttpServletResponse originalRes = (HttpServletResponse) ((HttpServletResponseWrapper) convertRes).getResponse(); Cookie linkedInCookie = new Cookie("linkedIn", util.getAppKey()); originalRes.addCookie(linkedInCookie);