Topic
  • 2 replies
  • Latest Post - ‏2013-02-01T15:57:43Z by SystemAdmin
SystemAdmin
SystemAdmin
30895 Posts

Pinned topic How to use the master session in Portal 8?

‏2013-01-28T11:41:50Z |
Hi all,

I'm developing a JSF portlet wich includes a Captcha. For requirement reasons I made my own captcha. Problem is that my captcha class use a session attribute, wich I can't access in the portlet session.

Beyond this I'll have need on my project to put things in the "master" session and things in the Portlet session. So I'm asking since I'm new how can I access the "master" session of the Portal, expecially inside a JSF Portlet.

The Portlet session was easy, I could use this to access it:

Set:

String objSessao = "lalalala";

FacesContext facesContext = FacesContext.getCurrentInstance();
ExternalContext externalContext = facesContext.getExternalContext();

HttpSession session = (HttpSession)externalContext.getSession(true);

session.setAttribute("Objeto", objSessao);

Get:

FacesContext facesContext = FacesContext.getCurrentInstance();
ExternalContext externalContext = facesContext.getExternalContext();

HttpSession session = (HttpSession)externalContext.getSession(false);

String retorno = (String) session.getAttribute("Objeto");

My captcha makes something like this:

HttpSession session = req.getSession(true);
session.setAttribute(CAPTCHA_KEY, ch);

But I can't access this attribute inside the portlet session. Is there a way to access the master session inside a JSF Portlet?

[]'s
Updated on 2013-02-01T15:57:43Z at 2013-02-01T15:57:43Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    30895 Posts

    Re: How to use the master session in Portal 8?

    ‏2013-01-30T15:40:35Z  
    Anyone? I thought this would be something kinda simple... But it's giving me the creeps... I still couldn't figure how to get the session my Captcha servlet puts the attribute.
  • SystemAdmin
    SystemAdmin
    30895 Posts

    Re: How to use the master session in Portal 8?

    ‏2013-02-01T15:57:43Z  
    Can anyone give me any example of how the sessions can be used in a JSF Portlet for Portal 8.0?!?!? Really this is killing me.