Re: getting PortletSession in faces portlet - Websphere

This is a discussion on Re: getting PortletSession in faces portlet - Websphere ; When I tried this PortletRequest request = (PortletRequest)FacesContext. getCurrentInstance().getExternalContext().getReque st(); my portlet is not getting displaed. It says portlet not available. But when I type cast it to HttpServletRequest, the portlet is getting displayed. i.e HttpServletRequest request = (HttpServletRequest )FacesContext. ...

+ Reply to Thread
Results 1 to 8 of 8

Thread: Re: getting PortletSession in faces portlet

  1. Re: getting PortletSession in faces portlet

    When I tried this
    PortletRequest request = (PortletRequest)FacesContext.
    getCurrentInstance().getExternalContext().getReque st();
    my portlet is not getting displaed. It says portlet not available.

    But when I type cast it to HttpServletRequest, the portlet is getting displayed.
    i.e HttpServletRequest request = (HttpServletRequest )FacesContext.
    getCurrentInstance().getExternalContext().getReque st();

    So I guess, the request object we are getting from external context cant be type casted to PortletRequest.

    I am stuck up here to get portletSession, since I need to communicate the change done in one page(portlet) has to be communicated to another page (another portlet).

    Any solution for this is highly appreciated.
    Thanks

  2. Re: getting PortletSession in faces portlet

    it should I would suggest opening a ticket with the rad team



    IBM Certified System Administrator -- WebSphere Portal V6.0, V5.1, V5.0

    IBM Certified Solution Developer -- WebSphere Portal V5.1, v6.0



    The postings on this site are my own and do not necessarily represent the positions, strategies, or opinions of IBM

  3. Re: getting PortletSession in faces portlet

    hi
    I am using RAD 6.0 and portal server V 5.1
    I have found 2 types of portlet projects we can create
    1)Portlet Project
    2)Portlet Project(JSR 168)

    I have created faces portlets by these 2 options
    When I created the faces portlet using first option, I was getting class cast exception
    PortletRequest = (PortletRequest) facesContext.getExternalContext().getRequest();

    But when I created faces portlet using second option I was able to type cast the request into Portlet Request.

    So what is the difference between these two kind of project
    Portlet Project and Portlet Project(JSR 168)

  4. Re: getting PortletSession in faces portlet

    the first one uses the IBm API which is a deprecated API



    IBM Certified System Administrator -- WebSphere Portal V6.0, V5.1, V5.0

    IBM Certified Solution Developer -- WebSphere Portal V5.1, v6.0



    The postings on this site are my own and do not necessarily represent the positions, strategies, or opinions of IBM

  5. Re: getting PortletSession in faces portlet

    Thanks Jim,
    I am working on existing project which was created by first option i.e deprecated IBM API.
    Now I want to share some information between the faces portlet.
    Since I am not getting PortletSession(because not getting PortletRequest from facesContext). is there any alternative that I can share the information between the portlets?

    I tried HttpSession also, the attributes in the HttpSession is also not shared among portlets.

    Your suggestion is helpful..

  6. Re: getting PortletSession in faces portlet

    http://www-128.ibm.com/developerwork...02_hepper.html


    IBM Certified System Administrator -- WebSphere Portal V6.0, V5.1, V5.0

    IBM Certified Solution Developer -- WebSphere Portal V5.1, v6.0



    The postings on this site are my own and do not necessarily represent the positions, strategies, or opinions of IBM

  7. Re: getting PortletSession in faces portlet

    Two things.

    First, you can get portlet request using the API you qouted in both cases, however if you are using a legacy portlet, not JSR168, PortletRequest would be a different class in a different package, so I presume you are casting it to the wrong class.

    Second, you don't even need the request object to get to the session in JSF. You can get the session straight from the External Context:
    FacesContext.getCurrentInstance().getExternalConte nt().getSessionMap()

  8. Re: getting PortletSession in faces portlet

    thanks,
    Ya you are right, in the deprecated IBM API, I could able to get PortletRequest when I type casted to "org.apache.jetspeed.portlet.PortletRequest". and able to get "org.apache.jetspeed.portlet.PortletSession" from this request.

    However this session is not shared between the portlets, as we can acheive in JSR 168 by mentioning (APPLICATION_SCOPE).

    the second point you mentioned getting sessionscoped Map by "FacesContext.getCurrentInstance().getExternalConte nt().getSessionMap()" also doesnt shared between portlet.

    Jim has provided the link that we could achieve this by creating PortletService.
    Can we acheive the sharing of information between the portlets by using existing API?

+ Reply to Thread