Portlet session

I have a small query regarding PortletSession. Could you please confirm if it's possible to use PortletSession in Java page flow controller portlet in weblogic.If yes, please share the sample code for the same.
We see only HttpSession. Is there a way to restrict the scope to User (like application Scope).
Waiting for your reply.

Hello,
The javax.portlet.PortletSession object is part of the JSR168 (Java Portlet) API and can be used only with JSR168 portlets. It will not work with other portlet types.
However, you can implement the same scoping functionality yourself using HttpSesssion by "namespacing" your session attributes. Attributes stored in HttpSession without any special scoping are the equivalent of the PortletSession's application scope, as there is one HttpSession per user session. To emulate the PortletSession's portlet scope using HttpSession, you can put a unique portlet identifier such as the portlet instance label in your HttpSession attribute names when you store or get attributes, such as:
String portletScopedAttributeName = portletInstanceLabel + "sampleAttributeName";Kevin

Similar Messages

  • JSTL, HttpSession and Portlet Session

    Here's a mysterious problem.
    I am trying to use portlet with JSP together. Inside the portlet, I populate some data, put the data into portlet session and dispatch (include) to a jsp. On the jsp, if I use JSTL to access the http session data:
    <c:out value="{sessionScope.test}"/> I got the following excepiton:
    14:27:08,880 ERROR StandardWrapper[portlet:jsp]:727 - Servlet.service() for se
    vlet jsp threw exception
    java.lang.IllegalStateException: Cannot access session scope in page that does
    ot participate in any session
    at org.apache.jasper.runtime.PageContextImpl.doGetAttribute(PageContext
    mpl.java:264)
    at org.apache.jasper.runtime.PageContextImpl.getAttribute(PageContextIm
    l.java:249)
    at org.apache.taglibs.standard.lang.jstl.ImplicitObjects$3.getValue(Imp
    icitObjects.java:633)
    If I use jsp scriptlet to access the http session, everything is fine:
    <%= request.getSession("test") %>
    Has anyone seen this exception? I posted the question on portlet forum already and no one is able to answer it so far.
    What's the different between JSTL sessionScope and jsp scriptlet?
    thanks!

    Try the calls
    <%= session.getAttribute("test") %>
    and
    <%= request.getSession().getAttribute("test") %>
    Make sure do not have on your page anywhere:
    <%@ page session="false" %>

  • Putting a HashMap in the portlet session

    I am trying to put a HashMap into a portlet session bean, so I am using this code
    HashMap sectype = getSessionBean(request).getAccess();
                   if (sectype == null){
                   Security security = new Security();
                   Vector secvec = security.findDistinctlevels(division, request.getUser().getID());
                   Iterator i = secvec.iterator();
                   while (i.hasNext()) {
                        sectype.put(i.next(),i);                                   
    getSessionBean(request).setAccess(sectype);
    it is falling over at the "if (sectype == null)" part. is there another way to test if the hashMap has been fullfilled by the session bean or I have to create one?

    "Falling over"?

  • Getting Portlet Session.

    HI,
    I have indidual portlet applications deployed in OAS Portal 10G. I need to pass user related information to all applications which are indidual portlets to do some co-branding. I know that I can append these as a parameter to the Portlet URL. But I don't want to do that. Apart from that what are the possible options to put that in Session and access them in other portlets?
    Please let me know.

    HI Sudip,
    Thanks for the reply.
    Can you please give me any sample code or explain me about using the PortletSession API?
    I never used that before and want a brief intro on that.
    If you have any articles or documentation, that would be real helpful.

  • Exchange Portlet - Session Cookies - Collapsing Portlets

    I am having trouble with the exchange portlet collapsing when refreshed.
    I have been tracing through the code and narrowed it down to a missing cookie in the PortletRenderRequest object.
    The process method in ExchangeProvider creates a new ApplicationLogin object using the PortletRenderRequest object.
    When the ApplicationLogin object is created it scans the cookie list in the request object for the exchangecookie which it then uses to populate the login details and sets the logged-in flag to true, if it can't find the cookie it assumes the caller is not logged in and sets the logged-in flag to false.
    The first time the ExchangeProvider.process method is called there are two cookies in the list (an exchangecookie and a JServSessionIdroot cookie) which is fine because it sets up the users details as expected, the second time it gets called (when you refresh the page) the exchangecookie has disappeared from the request object, so it leaves the ApplicationLogin object in the logged-in = false state, which inturn means the page does not get rendered.
    Does anyone know when the exchangecookie gets created and when it gets passed around? This would help in tracking down the error, or better still does anyone know how to fix this problem?
    Any help would be greatly appreciated.
    DJ
    P.S. There is a known problem in Oracle Financials and Application Server with cookies and IE, but this problem occurs in IE and NS so it does not appear to be browser dependent.
    null

    If I comment out caching and set login to "always" the portlets take 2-5 minutes to render, which is not acceptable for deployment.
    Can anybody fix the JPDK or the portlets?
    John
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Amr El Magayry ([email protected]):
    Alan ,
    Comment the code that do caching in the begining of each renderShow method in each of the four renderer classes (e.g. InboxRenderer,CalendarRenderer, ...), together with login freqeuncy set to 'Always', it will work.
    Pls Send me your code to fix the Ok & Apply buttons in the Customize page.
    Amr<HR></BLOCKQUOTE>
    null

  • How to reset the JSF Portlet session state in weblogic portal 10.3

    Hi All,
    We are implementing our application with the jsf1.2 with 10.3.0 portal framework.
    in a tab i placed my jsf portlet, it will navigate up to 4 pages. We do have some other tabs too in our application. So when i navigate to other tabs and when i comeback to the jsf portlet tab i am resetting the portlet state to first page by onDeactivation portal event.
    But the problem when the user within the tab and navigate to pages if he clicks again the tab it is not redirecting to start page.
    I know we do have refresh action in our pageflows .. but how to reset the jsf portlet to start page when it is not deactivating. Please do help me..
    Thanks in advance...
    Edited by: Siddu4u on Oct 10, 2011 8:33 PM

    Hello,
    This documentation should help you to use the import tool in the Portal Admin Console:
    http://download.oracle.com/docs/cd/E15919_01/wlp.1032/e14245/deployment.htm#i1047336
    Kevin

  • Any updates on Portlet/Servlet session sharing (for AJAX)

    Hey all,
    I've found a few threads about accessing the portlet session from a JSP that have gone stale. Has anyone found a good method for sharing the session in this way?
    I've read through Peter Moskovits ts-1941 presentation, but it's difficult to really follow by itself...and I'm reading through the paper on "Integrating Password Protection" and deep linking. I think I'm following all of the requirelments it lists to be able to access the session in "deep link" pages but no luck yet.
    Any one have some working examples? I'm pretty new to portlets so, some of the Oracle classes in the PDK are still unfamiliar terrain for me.

    An update. I adjusted some of my settings and now I can get things I create in my session in the portlet code to be visible in my JSP code when I make AJAX calls. Great.
    My problem now is that I can't get the actual portlet code to see the session objects. I'm trying the code I found in the Portal Developer's Guide to store the number of render requests in session:
    <pre>
    PortletRenderRequest pReq = (PortletRenderRequest)
    request.getAttribute(HttpCommonConstants.PORTLET_RENDER_REQUEST);
    ProviderSession pSession = pReq.getSession();
    if (pSession != null)
    String key = PortletRendererUtil.portletParameter(pReq, "count");
    Integer i = (Integer)pSession.getAttribute(key);
    if (i == null)
    i = new Integer(0);
    i = new Integer(i.intValue()+1);
    pSession.setAttribute(key, i);
    %>
    Render count in this session: <%=i%>
    <%
    else
    %>
    The session has become invalid
    Please log out and log in again.
    <%
    </pre>
    When I ran this code, I see a count of 1 on the first attempt. Then my session object disappears and I'm told the session has become invalid. I turned off the "same cookie domain" option and now my counter works correctly, but my JSPs no longer can see the session variables through session.getAttribute(...).
    I think I understand why turning off the "same cookie domain" stops the JSP from seeing the session object (even though my portlet is deployed on the server). Why does turning on "same cookie domain" stop the portlet from seeing the ProviderSession object after the initial request?

  • Distinguishing between two instances of the same portlet

    Hi Experts,
    Is there a way to distinguish between two instance of the same portlet in different browser windows?
    I'm looking for something like URL parameter passing, but just for portlets.
    The problem is, I want a way to pass a parameter between views in a portlet, but in such a way that if another browser window is opened and navigated to that portlet page, the parameter won't be the same. Perhaps I can explain better with this example:
    Page A has a portlet on it which has a textbox and 2 buttons - the first button stores the value in the textbox in the PortletRequest (or PortletURL) and if you click the second button the portlet navigates to a different view which displays the value. If I navigate with a second browser window to Page A, however, and only click the navigate button, that value which was stored by the first instance of the portlet will still be shown. I want them to be independent, I don't want changes in the one's PortletRequest to reflect in the other one's PortletRequest.
    Any ideas?
    Thanks,
    JP

    Why not use two instances of the same portlet, i.e. create two channels of the same portlet.
    The behave the same, have the same application logic, so all you need is to transfer informations between the two portlets.If you want this within user space use the portlet session, otherwise access the http session context /application context and store the data there.
    The behavior would be controlled by the portlet preferences, so channel a (instance 1) would be configured to run as controller and channel b (instance 2) would be configured as receiver.

  • Consuming web services in a jsr 168 portlet best practices.

    I am building portlets (jsr 168 api in Websphere Portal 6.0 using web service client of Rational). Now needed some suggestions on caching the web services data on the portlet. We have a number of portlets (somewhere around 4 or 5) on a portal page which basically rely on a single wsdl Lotus Domino Web Service.
    Is there a way I can cache the data returned by webservice so that I dont make repeated calls to the webservice on every portlet request. Any best practices/ideas on how I could do avoid multiple web service calls would be appreciated ?

    Interestingly, as it often happens with Oracle portal, this has started working without me doing anything special.
    However, the session events my listener gets notified of are (logically, as this portlet works via WSRP) different from user sessions. The problem I'm trying to solve now is that logging off (in SSO) doesn't lead to those sessions being destroyed. They only get destroyed after timeout specified in my web.xml (<session-config><session-timeout>30</session-timeout></session-config>). On the other hand, when they do expire, the SSO session may still be active, in which case the user gets presented with the infamous "could not get markup" error message. The latter is unacceptable in our case, so we had to set session-timeout to a pretty high value.
    So the question is, how can we track when the user logs off. We have found the portal.wwctx_sso_session$ and portal.WWLOG_ACTIVITY_LOG1$ (and ...2$) tables, but no documentation for them. However, the real problem with using those tables is that there's no way we could think of to match the portlet sessions with SSO sessions/actions listed in the tables. (Consider situation when someone logs in from two PCs.)
    Any ideas?

  • JSR 168 best practice for saving inter-portlet state

    The portlet specification doesn't yet cover inter-portlet communication. Until
    it does, what is the best practice for saveing state so that multiple portlets
    can use the same data?

    The portlet session is layered on top of the HTTP session except for
    attribute scoping. So, all portlets in a webapp share the same
    HTTP/portlet session for a given client.
    All APPLICATION_SCOPEd portlet session attributes are automatically
    available to other portlets. With PORTLET_SCOPEd attributes, portlet
    containers namespace attribute names, so it would be hard to get
    attributes by name (but still possible).
    Subbu
    Chris Jennings said the following on 10/14/2003 09:17 AM:
    If I set an attribute in a PortletSession, though, it isn't visible form another
    PortletSession... right? Please tell me that's wrong ;-) If that's right, how
    can I have portlet B get to something set by portlet A?
    Subbu Allamaraju <[email protected]> wrote:
    Chris,
    For sharing transient state, the only possible mechanism in V1.0 is to
    use sessions.
    Subbu

  • JSR 168 and Web Services For Remote Portlets

    Hi,
       I have recently joined SAP.In my previous work experience I have worked extensively on the Sun Java Portal Server and was curious about the following
    1.Does SAP Enterprise Portal Server support JSR 168 compliant Portlets.
    2.If yes the Question that naturally follows is:Can portlets(view Components)in a SAP Portal be remote enabled?In other words does SAP portal support WSRP standards.
    3.If the SAP Enterprise Portal has implemented  the JSR 168 specifications then how does the architecture seperate out the Portal engine from the Portlet Container.
    In other words where does the actual wrapping from a HTTPServletRequest to a Portlet Request happen?
    4.The JSR 168 specifications restricts the use of IFrames and many HTML tags in the fragments that are returned by the portlets running in the Portlet Container.Is this taken care of in SAP Enterprise Portal?
    5.Can WebDynpro applications be embedded in a JSR 168 compliant portlet?
    6.How is parity maintaned between portlet session HTTP session and the Applications session?
    7.Does SAP Portal support deployment through a par model?
    Thanks and Regards
    Sujeet Mishra
    SAP Labs India Ltd
    [email protected]

    > 1.Does SAP Enterprise Portal Server support JSR 168
    > compliant Portlets.
    I'd like to know the answer to this question as well. I wrote an email but didn't receive any response. So i guess JSR 168 isn't supported yet?

  • 10g Disco Portlets : Scalability across hundreds of users

    Hi,
    Looking for some insight to scaling disco portlets across hundreds of users. Using Discoverer 10g 10.1.2 and have a portal with about 25 Disco Portlets scattered across a few portal pages. (Using Oracle Portal also) Every user gets the same pages, but the content of Disco portlets is different by user.
    Most of the Disco Portlets are Worksheet Portlets showing a table + graph, the remaining disco portlets are Worksheet List portlets. Some portlets refresh hourly, and some are once a day.
    We've staggered hourly portlets at different times of the hour so they don't all refresh at say the 00 mark of each hour. Portlet A refreshes at 00 minute mark, Portlet B refreshes at the 10 minute mark, etc.
    Because each user needs to see different data, the disco portlets all use private connections vs. public connections, so each portlet graph shows different data depending on the user.
    What's happening is at the 00 minute mark, each user is having their Portlet A being refreshed. As the number of users grows, this just gets worse and worse. There seem to be refreshes happening constantly. The kicker is, these hourly refreshes happen regardless of the user looking at the portal that day or not.
    We're having challenges with scaling the portal as the number of users is growing. How did Oracle envision Disco Portlets to scale with hundreds/thousands of users? All we can do is stagger the hourly refreshes, but we can't stagger the users.
    We have Disco running on one unix server, the database on a 2'nd server, Portal on a 3'rd and Infra on a 4'th.
    Any insight into scaling Disco Portlets for the above scenario would be helpful.
    Thanks.

    Hi,
    Let me see if I can start the ball rolling for you on this one with some insight from previous implementations.
    "What's happening is at the 00 minute mark, each user is having their Portlet A being refreshed. As the number of users grows, this just gets worse and worse. There seem to be refreshes happening constantly. The kicker is, these hourly refreshes happen regardless of the user looking at the portal that day or not."
    1. The portlets will get refreshed once per main portlet and an additional refresh for each customization. This could explain why you are seeing more refreshes than you expected.
    2. The refreshes will occur per the schedule to refresh the data in cache whether or not the user is logged in.
    The way is works at very high-level is like this:
    The PortletProvider is a J2EE application running under OC4J_BI_Forms container.
    It polls PTM5_SCHEDULE table every 2 seconds or as specified by peekSleepIntervalSec parameter in the configuration.xml
    If a portlet refresh is found (ie the scheduled refresh time arrives) then the information about the refresh is added into a job queue within OC4J_BI_Forms.
    Java threads pick up jobs from the queue (parallel processing, maxsessions).
    For each job a session is picked up from the session pool, query is generated and sent to EUL/database to retrieve data.
    Next, retrieved data is processed into XML and stored in PTM5_CACHE table as BLOB.
    The PTM5_SCHEDULE table is updated with Last Refresh Date and Next Refresh Date, etc.
    The next time the relevant portlet is accessed in a browser refreshed data are read from PTM5_CACHE (and formatted per customization).
    Discoverer Portlet sessions can be pooled, enabling them to be reused by different Discoverer Portlets. Pooling Discoverer Portlet sessions saves CPU and memory resource usage.
    You can see how to control these parameters via the Application Server Control or $OH/discoverer/configuration.xml file in the documentation here:
    http://download.oracle.com/docs/html/B13918_03/con_files.htm#sthref1195
    Now having said that, there have been a few bugs in the Portlet provider regarding how the session pool behaves and one that does not kill existing dis51ws processes.(bug 4929480)
    I also seem to recall from past a bug about hourly refreshes specifically.
    (bug 4929480) is documented in
    Note 436135.1     Discoverer 10g (10.1.2) Sessions (dis51ws) Are Not Terminated After Timeout Causing Users Unable To Login     
    Oracle has produced some patches, but which one you apply really depends upon your version, environment (ie. EBS11i/SSO integrated or not), current patches applied and your platform.
    You may have to work that out with Oracle Support, but I can tell you in general some good one-off merge patches that you should apply (based on my experiences).
    From the note above:
    For versions 10.1.2.1 / 10.1.2.0.2 (Discoverer 10.1.2.48.18 and 10.1.2.50.05):
    Patch 5922220 is the latest known Portlet merge patch on top of 10.1.2.1 (10.1.2.50.05) for E-Business Suite Single Sign-On integrated customers and Patch 5497101 is the latest known Portlet merge patch on top of 10.1.2.1 (10.1.2.48.18) for other customers. Both of these patches include the above fix.
    # For versions 10.1.2.2 (Discoverer 10.1.2.54.25):
    * We recommend you apply Discoverer "cumulative patch II" ( Patch 6129303 ) as directed by Oracle Support if it is appropriate for your environment.
    I would consider:
    A.) Make sure you are patched appropriately
    B.) Make sure you have tuned your Discoverer portlet session pool.
    C.) If the load is large enough, you may need to consider an additional Discoverer standalone server with a load balancer.
    A note on that: Load balancing portlets is a bit different than standard HTTP applications (Plus/Viewer) since each portlet application on each server will be checking the refresh table in the metadata repository (infrastructure) database.
    You will have to ensure:
    a.) the times on each server is synchronized
    b.) the the peeksleepinterval is adjusted on each server to accommodate a smaller server vs. larger server (ie. which one you want to pick up more of the refreshes)
    Oracle Support has documented those pretty well in MetaLink document 360310.1     How Discoverer Portlet Provider Refreshes Are Distributed In A Load Balanced Environment
    I hope that helps get you started.
    Other comments / experiences welcomed.
    Regards,
    Steve.

  • Losing portelt session after every request

    Using bwa wl portal server 8.1 on wxp sp2
    Hello all
    We wrote some JSR 168 compliant portlets and deployed them accoring to the bea doc. Basically our portlets seem to work. However, there are some issues that could be tracked down to one problem:
    Somehow the session gets lost on every request! One action request uses the same portlet session during action/render cycle, but two consecutive calls to the same portal page yield different sessions, so holding any session variables is next to useless.
    The deployment szenario is this:
    Using bea workshop i created an application and deployed our complete jsr168 portal application. Since bea does not enforce a login/does not impose any login restrictions, i created another application which imported a second portal project, which used the first application as a wsrp portlet provider.
    The second application merily consists of a web.xml containing only security restrictions:
    <web-app id="WebApp">
    <display-name>Livelink Portal Integration Kit</display-name>
    <security-constraint>
    <web-resource-collection>
    <web-resource-name>Portal</web-resource-name>
    <description>Security constraint for the whole portal</description>
    <url-pattern>/*</url-pattern>
    <http-method>GET</http-method>
    <http-method>POST</http-method>
    </web-resource-collection>
    <auth-constraint>
    <description>all users</description>
    <role-name>Users</role-name>
    </auth-constraint>
    </security-constraint>
    <login-config>
    <auth-method>BASIC</auth-method>
    <realm-name>default</realm-name>
    </login-config>
    <security-role>
    <role-name>Users</role-name>
    </security-role>
    </web-app>
    At first i tried to add these security restrictions to the wsrp application but then the wsrp provider could not be reached so i split the applications.
    So - how do i prevent bea from created a bunch of sessions? What am i doing wrong?

    Hi
    In server.xml, do you have cookies=true for both contexts (and the defaultContext)? I'm not sure how it would behave if one context was true and the other false.
    Alternatively, could it have something to do with the crossContext attribute?
    --Jon                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Keep-Alive Portlet

    Does anyone know of a keep-alive portlet that will keep the users session alive while they are on a specific page? My problem is that the users are getting logged off of the portal after 20 minutes of inactivity, so what I'd like to do is have a portlet that will post back behind the scenes every 5 minutes or so, in order to keep the portal from logging the user off. Does anyone know of any such portlets?
    Thanks
    -Ben

    Couple of questions:
    * What version of the portal are you using?
    * Is the portal session timing out or is this a specific portlet?
    The portal's session timeout can be controlled by editing config files and restarting. For a portlet - if you're experiencing a session timeout, can you bump up session duration through the remote web server? For portlets we control we usually try to match remote portlet session timeout to the portal's timeout. Since we try to do everything as a gatewayed portlet this usually works well for us.
    Thanks,
    Eric

  • Inter-Portlet Communication Best Practices

    Here's the situation:
    There are 2 Portlets on a page; a Search Portlet and a List Portlet. When a user selects search criteria in the Search Portlet and presses the Submit button the items displayed in the List Portlet must be updated to reflect the search criteria that was entered.
    My approach to implementing this:
    When the user presses the Submit button the Search Portlet code will take the information entered by the user and create a searchObj. This searchObj will be attached to the Http Session object. When the Search Portlet is rendered again in the browser it will recognize (via a hidden HTML attribute) that it needs to inform the List Portlet that there is new search criteria. The browser will then generate a Portal Event that will cause the List Portlet to refresh its list based on the searchObj it finds attached to the Http Session object.
    Question 1:
    Assuming this is a reasonable approach how do I get the Search Portlet to generate an event based on a HTML hidden field at the time the Portlet is rendered?
    Question 2:
    Is there a better way to implement this type of functionality? Essentially the problem is that one Portlet needs to process some data and once it's done it needs to notify other Portlets. What are the best practices for this type of situation?
    Any suggestions are welcome.

    Hi,
    As per the JSR 168 Specification, we follow PortletSession with APPLICATION_SCOPE for implementing IPC ( inter portlet communication ).
    Here are the steps for IPC:-
    1. When you press submit from search portlet then fetch the search string value into the processAction method of the search portlet.
    2. Put the search string value in the portlet session with APPLICATION_SCOPE.
    3. When you press submit of search portlet, doView() method of both the portlets
    ( Search and List ) will be called.
    4. in the doView() method of List portlet retrieve the search string from the portlet session and call the business logic based on the search criteria.
    5. Put the search result into bean or as per your framework design.
    6. Iterate the bean value on to your List portlet rendering jsp.
    Note:-Here it is assumed that both the portlets are in the same ear/war.
    The coming JSR 286 specification, allows a portlet to send and receive events and perform state changes or send further events as result of processing an event.
    In JSR 286, we would be having one more request and reponse called EventRequest and EventResponse.
    Comments and suggestions are welcome for IPC.
    Thanks
    <Neeraj Sidhaye/>
    Try_Catch_Finally AT YAHOO DOT COM
    http://ExtremePortal.blog.co.uk

Maybe you are looking for

  • Unable to activate Creative Suite 2 in Windows 7?

    Unable to activate Creative Suite 2 in Windows 7. Error message states: "The serial number you provided is not valid.  Please check your serial number and re-enter it."  I do have an active serial number and when talking to the tech, he stated that i

  • BW Upgrade 3.1 to 3.5

    Hi We need to upgrade BW 3.1 to 3.5. Where I can get detail documents for this? Vijay.

  • Play iTunes Movie on BlackBerry Torch 9810

    There is definitely no shortage of M4V to MP4 converter on the Internet. One of the best M4V to MP4 converter is called Tune4mac iTunes M4V Converter Plus, which is able to remove DRM control from iTunes M4V movie rentals and purchases and convert M4

  • SharePoint 2010 Upgrade from SharePoint 2007

    Planning to stand up a new SharePoint 2010 farm.  Currently have a MOSS 2007 farm with integrated Project 2007.  Looking for online links [Book recommendations fine also] for the best process to get all the guts over in the cleanest way possible.  Al

  • Standard Image for Deployment

    Dear All...........I am looking to build a solution for our helpdesk who have to install OS and Applications to customers laptops on daily basis. At the moment, I am trying to understand different aspects so there are some confusions which I would li