Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Paolo Pilitti
[Solved] how to set and read cookies in renderRequest and portletRequest
November 7, 2013 2:03 AM
Answer

Paolo Pilitti

Rank: Junior Member

Posts: 51

Join Date: April 13, 2011

Recent Posts

hi all

I'm struggling to read and set cookies in request response

can someone explain a clear way to :

1) set cookies in renderResponse and resourceResponse
2) read cookies in renderRequest and resourceRequest?


in more detail i can set the cookies in resourceResponse and read in resourceRequest but i can't ( and i want to)read the values from renderRequest
venka reddy
RE: ! how to set and read cookies in renderRequest and portletRequest
November 4, 2013 11:36 AM
Answer

venka reddy

Rank: Regular Member

Posts: 231

Join Date: March 23, 2011

Recent Posts

In Liferay , username is setting in cookie by using HttpRequest and HttpResponse objects, Look into the LoginUtil.java

Follow the below URL not exact your looking may be it will helpful to you

Setting Cookies in Liferay.


if you find anything additional , do share .
Ritresh Girdhar
RE: ! how to set and read cookies in renderRequest and portletRequest
November 5, 2013 2:37 AM
Answer

Ritresh Girdhar

Rank: Junior Member

Posts: 67

Join Date: July 15, 2011

Recent Posts

Hi

First of all you need to get HttpServletResponse from PortletResponse. then only you can set Cookie in response.

Ex:
HttpServletResponse response = PortalUtil.getHttpServletResponse(portletResponse);
Cookie cookieParam = new Cookie("cookieParam ", password);
response.addCookie(cookieParam);


Regards
Ritresh
Paolo Pilitti
RE: ! how to set and read cookies in renderRequest and portletRequest
November 7, 2013 2:02 AM
Answer

Paolo Pilitti

Rank: Junior Member

Posts: 51

Join Date: April 13, 2011

Recent Posts

thank all,

the cookie started work when i set version

myCookie.setVersion(0)

regards

Paolo