Forum

Accueil » Liferay Portal » English » 3. Development

Vue combinée Vue Plate Arborescence
Sujets [ Précédent | Suivant ]
toggle
Paolo Pilitti
[Solved] how to set and read cookies in renderRequest and portletRequest
7 novembre 2013 02:03
Réponse

Paolo Pilitti

Rang: Junior Member

Publications: 51

Date d'inscription: 13 avril 2011

Publications Récentes

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
4 novembre 2013 11:36
Réponse

venka reddy

Rang: Regular Member

Publications: 231

Date d'inscription: 23 mars 2011

Publications Récentes

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
5 novembre 2013 02:37
Réponse

Ritresh Girdhar

Rang: Junior Member

Publications: 67

Date d'inscription: 15 juillet 2011

Publications Récentes

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
7 novembre 2013 02:02
Réponse

Paolo Pilitti

Rang: Junior Member

Publications: 51

Date d'inscription: 13 avril 2011

Publications Récentes

thank all,

the cookie started work when i set version

myCookie.setVersion(0)

regards

Paolo