how to handle session-timeout in producer-consumer(wsrp) environment. - WebLogic Server - Clustering

Hi ,
We are using weblogic portal 9.2 in federated environment (wsrp) .
We have one consumer Ear and some producer Ear .
we want if session is time out ,then user should direct to some default page .
For that we are firing event in Base Exception handler where we caught all exceptions.
that event is listen by consumer side ,(when session time out producer raise event).
event is fired , every thing looks fine but we are not able to redirect page from producer to consumer (which should not be happen )
I think we are doing something wrong .
Any suggestion/ guidance will help us lot
thanks in advance 

Hello,
What is happening?
1. Redirection is happening and you dont want that
or
2. Redirection is not happening and you want it to happen?
Remember you can route the control to an error page on the consumer side by using interceptors or in the remote portlet errorUri.
Also that Consumer would have committed the response to the client before the rendering phase starts. So you might get into IllegalStateExceptions. We solved the problem by landing into a temperory page and use HTML <meta> tags to redirect to appropriate page.
Thanks,
Paz

Related

How to Listen an event before the page Renders

Hi , we fired an event from the header . I want to listen the payload and show that data from the payload in a portlet on the page.
But am not getting the data into the portlet. From the logs i can see that after the pageflow action executed, backing file is executed. 
What part of the lifecycle are you using in the backing file?
Consider using handlePostBackData in your backing file.
See:
http://download.oracle.com/docs/cd/E13155_01/wlp/docs103/portlets/ipc.html
Also, for some older but good basic reading, see:
http://download-llnw.oracle.com/docs/cd/E13218_01/wlp/docs81/sp3/pdf/netix.pdf
http://download.oracle.com/docs/cd/E13218_01/wlp/docs81//sp3/pdf/ipcguide.pdf 
I tried in handlepostback data,its not consistent.
My actual problem is , am firing a event from a portlet and another portlet(Which is on the same page) listens the event.Is there any way we can handle the event before the action method of the listened portlet gets executed. 
Hello,
In WebLogic Portal (and portlet standards such as JSR286 and WSRP) the action phase of the lifecycle comes before the event-handling stage. There is no way to send an event which is received before the action processing happens, but you should be able to re-order your code to still do what you want to do.
Kevin 
Can you suggest me the re ordering of code? I mean what need to be done to achieve the current scenario 
Hello,
Put the code that is now in your action processing (that you would like to run last) in the event handler. That way, when the event is received (last), that code will be run.
Kevin

how to handle session-timeout in producer-consumer(wsrp) environment.

Hi
We are using weblogic portal 9.2 in federated environment (wsrp) .
We have one consumer Ear and some producer Ear .
we want if session is time out ,then user should direct to some default page .
For that we are firing event in Base Exception handler where we caught all exceptions.
that event is listen by consumer side ,(when session time out producer raise event).
event is fired , every thing looks fine but we are not able to redirect page from producer to consumer (which should not be happen )
I think we are doing something wrong .
Any suggestion/ guidance will help us lot
thanks in advance 
Hello,
I assume you are setting the redirect URL during the event handling on the producer side? The WSRP specification does not allow redirects during events; redirects can only be sent during a WSRP PerformBlockingInteraction call, which corresponds to WLP's handlePostback lifecycle, or JSR168 portlets' processAction lifecycle.
To effect a redirect at this lifecycle stage you can always just render the HTML page with a client-side redirect on it, or activate another page on your portal.
Kevin 
Hi ,
thanks for your help, but we are not redirecting from an event . we are just raising events at producer side .
and then consumer listening that event .on the basis of event name consumer displays his pages .
in ideal condition when we fired event and returning from producer nothing should be comes in between , but i guess there is lots of thing happening between after event firing and reaching to consumer side in our case ,thats a problem .
looking for more suggestion.
thanks 
Hello,
Probably the easiest way for you to get the behaviour you want would be to put a event handler on a .portlet file (on the consumer) that lives on the page you want to activate if the producer session has timed out. For example:
<netuix:handleCustomEvent event="eventNameComingFromProducer" eventLabel="sessionTimeoutPageActivation">
<netuix:activatePage/>
</netuix:handleCustomEvent>
When your producer portlet sends an event "eventNameComingFromProducer" the portlet on the page you want to activate will pick it up and automatically activate the page.
Kevin

How to view the portlet properties in the streamline mode

Hi,
I have configured my portal in the streamline mode. I had a problem on one of the page which has 3 portlets(A,B,C).
When the user clicks on a link in the portlet A, based upon his selection we should be showing either portlet B/C and A should be hidden.
I achieved this by forwarding it to the same pageURL and on the pageFlowRefreshAction I used PortletBackingContext and made the setVisible property to false. But for some reason it is not working on the production server(portlet A's refreshAction is not invoked) where the portal is configured in the streamline mode.
Is there a possibility to view this portlet's refreshAction in the streamlinemode?
Please help.
Thanks & Regards
Prakash 
refreshAction specified do get executed even in streaming mode. In the scenario you describe what does the link in portlet A have? If the link has an Action , then refresh action does not get executed (whether in streaming mode or not), the action specified would get executed.
There are also other ways to achieve what you want. If each action is explicit then you could directly configure the portal to hide/show portlets. Otherwise you need to use Backing Files and/or events
regards
deepak 
Hi Deepak,
Portlet A contains links which invokes one pageFlowAction. The links has some netui:parameters to decide which portlet should be hidden/show. After executing this validations or some business processing in that pageFlow action, i constructed the pageURL using the portlet API as:
/***
PageBackingContext backingContext = PageBackingContext.getPageBackingContext(this.getRequest());
PageURL pageUrl = PageURL.createPageURL(this.getRequest(), this.getResponse(), backingContext.getLabel());
forward = new Forward(new URL(pageUrl.toString()));
***/
Since we forward it to the same page containing those 3 portlets, the refreshAction of those portlets are invoked. And inthose refresh action methods i disabled the portlets using PortletBackingContext(by taking help of some session attribute).
The thing is that the refreshActions of the portlet B and C are invoked. But the portlet A's refreshAction is not invoked. And the most annoying fact is that it worked fine in my local PC. But for some reason it's not in LINUX box. 
As before if you raise an action in portlet A , that action will get invoked. The rest of the portlets on the same page would get their refresh actions invoked. This behavior is correct and would not have worked on your local either.
This would only work if there was no action , in which case the refresh action of all 3 get invoked.
Secondly if you want to hide a portlet correctly, you should do it in backing file , the pageflow is executed after prerender. 
Thats's true. I agree.
But I swear that it worked in my local. and for that it also worked on LINUX machine also. After that there is an update in the platform where our war file is deployed. Since then we are facing this issue.
And as you mentioned in the earlier post..
"If each action is explicit then you could directly configure the portal to hide/show portlets." What's the way to achieve this? 
But I swear that it worked in my local.Well try it out again place appropriate debug statements. i assume you mean the refresh action you specify in portlet properties (and not the onRefresh method you can inherit)
In any case, what I meant was if your links have actions like showPortletB and showPortletC (different actions rather than the same action with different parameters) you can use the Event Handler on the portlets to listen for this action and hide and the portlet without code. If it is parameter based then probably using a BackingFile which hides/shows portlets is a better option (you could also implement this with custom events if you needed)
regards
deepak 
Thanks for the info.

Redirection Issue when Using WSRP

I have two portlets in Producer EAR, Portlet A and Portlet B where user accesses both these portlets from Consumer EAR as the remote portlets. Portlet A displays the Profile Information and if we click on edit button on Portlet A it redirects to Protlet B where User can edit his Profile information.
After User making the changes he clicks on submit to save changes. With Submit action the User should
be redirected to Portlet A where he can view the updated information. I have an issue redirecting to
the portlet A after making changes and clicking Save changes in portlet B. There is inconsistency in the redirection. That means, redirection takes place sometime and sometime it does not happen (Even after clicking on the 'Save changes' in the portlet B, the changes take place in DB but the portlet B still shows up).
For the Redirection, I am firing a custom event with the payload as the pageurl Where portlet A is located.
Can any one help me regarding this. 
Hello,
Unfortunately, in current versions of WLP (10.3 and earlier) there is no way to reliably issue a redirect from an event handler (over WSRP or not). The next version of WLP will have this ability when it comes out, but that can't help you right now.
The only current way to issue a redirect reliably over WSRP is to do so from inside the handlePostback method on the backing file (or processAction() in JSR168 portlets).
If portlet A and portlet B are not on the same page-- if you are issuing the redirect to make a page change happen-- there is another option though: you can fire an event and have the proxy portlet (on the consumer side) for portlet A listen to the event and change to the page. This requires creating the remote portlet on the consumer in the IDE (it cannot be done through the Portal Admin Console), and then adding an event handler to the proxy portlet that gets created, and have that event handler change to the current page.
Kevin 
Hi Kevin,
Thats how am doing rt now.
Am firing a custom event with the page label of the portle A as payload.
Then there is a proxy portlet which listens to this event and a backing file is associated with this portlet.
In the backing file am putting that page label in session.
Afte that a page flow action is taking place where am using the handlePostBack method to redirect to the corresponding page by creating the page url by retreving the page label from session.
and even i tried with preRender also
Even this is inconsistent.
And from the backing file itself ,as we have the page label as the payload, Can't we user directlty the reponse.redirectUrl to redirect to the corresponding page?
Edited by: user10991759 on Dec 8, 2009 9:56 AM 
Hello,
It isn't possible to use response.redirectUrl() directly as the response may (or may not) already be committed; this is why you are seeing inconsistent behavior-- it depends on whether or not the response has already been committed, and there is no way to control that after the handlePostbackData lifecycle takes place.
Instead of issuing a redirect, you would be much better off using the "activatePage" event handler on your proxy portlet .portlet file for portlet A. For example:
<netuix:handleCustomEvent event="yourEventName" eventLabel="yourEventLabel" onlyIfDisplayed="false">
    <netuix:activatePage/>
</netuix:handlePortalEvent>This means that when the event "yourEventName" is fired, the portlet that has the above sample XML in its .portlet file will make the page change so that that portlet is displayed. There is no need to know what page label it is on, no need to issue a redirect; the "activatePage" element will make the page that portlet is on active when the event is received.
Kevin 
Hi Kevin,
Can i directly user this activate page on the portlet A it self with out having proxy portlet?
Previously I used the proxy portlet where a backing file is attached to this portlet and when ever user wants to redirect to any page am using this proxy portlet to handle the redirect event .
And as am getting the corresponding pagelabels as payload, am using this proxy portlet as generic portlet for all the redirect events with different payloads.
So in this case, when the user clicks save changes on portlet b he has to be redirected to portlet a .
Can i directly fire an event named saveChagesandRedirectToA and use the code you sent(activate page ..) directly on portlet A. 
Hello,
I believe you can use the "activatePage" directly on the producer-side .portlet file for portlet A; you would need to re-create the proxy portlet on the consumer side to get the change picked up, but I believe that should work. You would then be able to directly fire the event and the page would "magically" change without needing any backing files or redirects.
Kevin 
Hi Kevin,
Thank you for the help. I will try and get back to you.
Edited by: user10991759 on Dec 8, 2009 12:17 PM 
Hi Kevin,
Now i can Successfully Come back to the page where portlet A is located but the updated Values are not being Reflected on the Corresponding Page.
The Page consists of page flow portlets which delas with pageFlow and page Flow Refresh Action.
I guess those two actions are not invoked. How to invoke those ? 
Hello,
Glad the page change worked. I am not surprised the pageflow refresh actions didn't get invoked, because the pageflow portlet is no longer being "targeted", but I'm not a pageflow expert. Perhaps if you moved the logic in the pageflow refresh action to another action and invoked that?
Does anyone else here on the forums have an idea on how to invoke multiple pageflow actions on a single request?
Kevin 
As it is marked as answered, no one is Looking through 
Hi kevin,
I invoked the page flow action like the code below.
<netuix:handleCustomEvent event="xyz" eventLabel="createEvent" onlyIfDisplayed="false">
<netuix:activatePage/>
<netuix:invokePageFlowAction action="begin" />
</netuix:handleCustomEvent>
My problem is the begin action is called twice. I dont know why.Can anybody help me on this. 
Hello,
I am not an expert with PageFlow, but my bet would be that the "activatePage" is calling the begin action when the page change is made, and then "invokePageFlowAction" is doing it again. I would try removing the <netuix:invokePageFlowAction action="begin" /> tag and see if it works for you (getting called just once).
If that doesn't work, try re-posting your question in a new forum thread so that other people will take a look at it.
Kevin 
Its not only the problem with begin action . Even if i give another action lets say invoke page flow action "CreateGroup" its is also getting called twice. If i remove the page flow action, no action is getting called. 
Hi Friends,
I have "protlet A(AcctinfoController.jpf)" & "portlet B(BillinfoController.jpf)", on change of a drop down value present in "portlet A", "portlet B" needs to be refreshed with different data.
Now the solution i am trying to implement is "portlet A" has a backing file with a custom defined method. A customeEventHandler has been added in "portlet A" which intern invokes custom method defined in backing file, in this method i do fireCustomeEvent("RefreshData".SelectAccount).
<netuix:portlet asyncContent="ajax"
backingFile="com.rogers.isp.jpf.order.tacbacking.AccountInfoBacking"
definitionLabel="acctinfo" title="Account Info">
<netuix:handlePageFlowEvent action="showAccountDetails" eventLabel="showAccountDetails"
fromSelfInstanceOnly="true" onlyIfDisplayed="true">
<netuix:invokeBackingFileMethod method="fireEventOnAcctNoChange"/>
<netuix:activatePage/>
</netuix:handlePageFlowEvent>
<netuix:content>
<netuix:pageflowContent contentUri="/com/AcctinfoController.jpf"/>
</netuix:content>
</netuix:portlet>
Now in "portlet B" trying to handle that custom event with pageflowAction.
<netuix:portlet asyncContent="ajax" definitionLabel="billInfo" title="Billinfo">
<netuix:handleCustomEvent event="refreshBillingInfo" eventLabel="refreshBillingInfo"
fromSelfInstanceOnly="false" onlyIfDisplayed="false" sourceDefinitionLabels="acctinfo">
<netuix:invokePageFlowAction action="begin"/>
<netuix:activatePage/>
</netuix:handleCustomEvent>
<netuix:content>
<netuix:pageflowContent contentUri="/com/BillinfoController.jpf"/>
</netuix:content>
</netuix:portlet>
Problem is , I am able to come to backing file method and fire the event. in "portlet B" not able to invoke pageflowaction.
I am using Oracle Weblogic 10R3.
Please help me, urgent
Thanks - Venki
Edited by: user8843829 on Jul 20, 2010 2:22 PM 
Hello,
Two quick suggestions:
1) When posing a new question on the forum, I would suggest starting it in a new thread, rather than starting at the end of an old thread.
2) The .portlet file you give for portlet "B" has "sourceDefinitionLabels="acctinfo"" in it-- this restricts when this event handler is allowed to be used, and though it looks right, my first suggestion is to eliminate this from the portlet "B" file to see if that fixes things.
Also, where are you sending the event "refreshBillingInfo" that portlet B is supposed to be listening to?
Kevin

Problem with Firing Events

Hi All,
AM new to this forum... The scenario is am trying to establish a remote portlet communication..
Steps have done so far:
1. Have created 2 portal applications(one for producer and one for consumer)
2. The consumer portal application has totally 2 pages in it..
3.THe consumer portlet is in page 1 and producer portlet is in page 2..
4. Now am trying to establish a connection between them..
5. Am firing an event from consumer(page 1) and producer(PAGE 2) listens to it.
6. The event is getting fired and the method which is specified in the prioducer class is executed with no errors..
7. But once the execution is done, it renders back to consumer's doView method instead of Producers do view method..
plzz let me know why this is happening 
Hello,
I'm not sure I understand the problem-- is it that the consumer-side portlet's doView() method is getting called before the producer-side portlet's doView() method? Or are you trying to cause the page to switch to the page the remote portlet is on when it receives the event?
Kevin 
Hi Kevin,
THanks for the reply..Yes the consumer's doview() is called before the producer's doview()..
ok to be appropriate..
This application is manily used for search..
So when i click on the search button(on the consumer's side), the appropriate producer's event method is called..But after exceution it goes back to consumers doview() instead of producer's doview()..
Its kinda urgent..plzzz let me know
Regards 
Hello,
There is no guarantee for the order portlets are rendered in (their doView() method is called) in the portal. It may be consistent in one configuration and setup, but if a user moves a portlet on a page or you start taking advantage of asynchronous rendering of portlets to increase performance, the portlets will be rendered in a different order. So basically you can't count on one portlet being rendered before another one is.
For this reason it is always a best practice to ensure that all your portlets are capable of rendering in any order and whether or not another portlet is being rendered at all. To accomplish this, you just need to move any code that you need to run before the render (on either the consumer or producer portlet) to the event handler code (again, either on the consumer, producer or both, as your needs require).
Kevin 
HI Kevin,
Thanks for the reply..Could you give me any example of how to achieve because am newbie to IPC..
Anways i will brief you about the problem am facing incase you are not clear..
Cannot paste the code due to company violation..SO am briefing out the problem again..
Have a PorletA in Page 1 and PortletB in page2
POrtletA acts as the consumer which has search functionality with a text box and button..
POrtletB displays the results based on the query text from text box...
And totally we have 20 applications of similar scenario with search functionality.. So we decided to make PortletB as remote portlet..In our case,it acts as producer and all other 20 applications acts as consumer which consumes the PortletB in their application..
so what i have done so far
When the user enters the text in the text box in PortletA and click the Go button, the even should be triggered..And i have created a method in PortletB which handles the event..
Since PortletA and POrtletB are in different page,am trying to get the pagecontext and getting the payload in which have set the parametrs from consumer..
But the problem is now the method gets executed but then the control moves back to PortletA(consumer's) doview() which i dont want to be displayed..
I want the doview()(Producer's) of portletB to be rendered after the even method is executed..
please provide me with examples of how to achieve it
thanks 
Hello,
If I understand correctly, you want the page to change when a search is done so that the user sees only portlet B (the remote portlet) after submitting a search- is that correct?
To do that, all you need to do is put an "activatePage" handler in your remote portlet's .portlet file (on the producer side), such as:
<?xml version="1.0" encoding="UTF-8"?>
<portal:root xmlns:html="http://www.w3.org/1999/xhtml-netuix-modified/1.0.0" xmlns:portal="http://www.bea.com/servers/netuix/xsd/portal/support/1.0.0" xmlns:netuix="http://www.bea.com/servers/netuix/xsd/controls/netuix/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bea.com/servers/netuix/xsd/portal/support/1.0.0 portal-support-1_0_0.xsd">
    <netuix:portlet title="Sample Page Activating Portlet" definitionLabel="eventsLinkDef1">
        <netuix:handleCustomEvent event="SampleCustomEvent">
            <netuix:activatePage /> <!-- This changes the page to the page this portlet is on when this event is received -->
            <netuix:invokeBackingFileMethod method="yourExistingEventHandlingMethodNameHere"/>
        </netuix:handleCustomEvent>
        <netuix:titlebar>
            <netuix:minimize/>
            <netuix:maximize/>
        </netuix:titlebar>
        <netuix:content>
            <netuix:jspContent contentUri="whatever"/>
        </netuix:content>
    </netuix:portlet>
</portal:root>Kevin 
I forgot to mention earlier-- after adding this to the .portlet file on the producer, you will need to re-add the remote portlet on the consumer side (through the Workshop IDE or Admin Tools, whichever you used before) for the changes to take effect. While you set this setting on the producer side, it is the consumer that needs to know about it, so it needs to get the updated definition of the portlet from the producer to activate the page properly at runtime.
Kevin 
Hi,
Thanks for the quick response...Alreay i have an event handler in the producer .portlet file which will call the respective method to handle the event from consumer.the action type in the event handler is Invoke Java Portlet Method..so u want me to add another event handler to producer portlet with activate page action ??? 
Yes, by adding the activatePage to the producer's .portlet file, it will cause the page the producer portlet is on to be displayed when the event is received.
Kevin 
Hi,
Thanks for the response..It worked perfectly.. But i have a property file and when i read the value from it,getting a nul pointer exception.. Is it something that we cannot read values from property files in WSRP... 
Hello,
There should be no issue with reading property files if your portlet happens to be run over WSRP, so long as the property file exists on the producer side with the portlet in the same webapp (you can't put it on the consumer side).
Kevin 
Hi,
THanks Kevin...Will let you know once done

Categories

Resources