This discussion is archived
3 Replies Latest reply: Jan 28, 2009 8:00 AM by 681696 RSS

WSRP Error Handling through Consumer Entitlement

681696 Newbie
Currently Being Moderated
Hi

Is there are way to do entitlements in the Consumer side based on the Availablity of the Producer. Say If the producer is down then a particular book or page in consumer portal needs to be hidden. We can use interceptor for catching the error and displaying a error message on the screen, but how we can hide the page itself through entitlement.

Thanks
Rajesh A.r
  • 1. Re: WSRP Error Handling through Consumer Entitlement
    669362 Newbie
    Currently Being Moderated
    Hi,

    We can imagine to use a session property set to store information about the availibility of the wsrp producer and then build an entitlement uppon it.
    But, keep in mind that you won't be able to handle the availablity of the producer with a WSRP interceptor. There is a little weakness in BEA's WSRP implementation about interceptors.
    One other thing to try would be to modify the WebContent\framework\features\proxyportleterror.jsp in the look and feel to change the way an error is displayed for a proxy portlet. This may give you the functionality you want without having to do anything with the interceptors.

    Emmanuel
  • 2. Re: WSRP Error Handling through Consumer Entitlement
    650850 Expert
    Currently Being Moderated
    Hello Rajesh and Emmanuel,

    Emmanuel is correct that you can't usually do what you want in an interceptor- at least not a GetMarkupInterceptor. The problem is the way the portal lifecycle is run in WLP-- a tree of controls is built up, then pruned by entitlements, then the remaining controls are asked to render onto a page. The WSRP getMarkup operation is performed during the last stage of this lifecycle-- during render, when it is already too late to not have a portlet show up. Indeed, when the getMarkup operations are run, it is already too late to issue a redirect, so you wouldn't even be able to set entitlements and then redirect back to the same page.

    So the first page view that recognizes that the producer is down is too late to simply not have the portlets appear on the page, but you can make the interceptor take steps so that the next person that tries to view any page with remote portlets on it from that producer just won't see them. In addition, you can make the interceptor provide the markup for the portlet that failed to be retrieved from the remote producer, or some sort of message in its place.

    You may want to take a look at the producer disabling functionality built in to WLP:

    http://edocs.bea.com/wlp/docs102/javadoc/com/bea/wsrp/consumer/management/producer/ProducerManager.html#disableProducer(java.lang.String,%20java.lang.String,%20javax.servlet.http.HttpServletRequest)

    If you used the disableProducer() method in your interceptor when you notice that the producer is not responding, you can tell all portlets coming from a remote producer to not be rendered-- but only for future page renders; again, it is already "too late" for the page that notices the producer is down, at least if the producer being down gets noticed during getMarkup.

    If you detect the producer being down during the InitCookie, BlockingInteraction or HandleEvents WSRP operations, these all occur before render, so you would be able to disable the producer, or set entitlements, or even do a page redirect at that point in time. But during the GetMarkup operation, the page is already "committed" and there is no way around the problem at that time.

    Kevin
  • 3. Re: WSRP Error Handling through Consumer Entitlement
    681696 Newbie
    Currently Being Moderated
    Thanks guys...

    It works .. I am able to catch the Producer IO Failure in the IInitCookieIntercerptor. In the onIOFailure(), I added a session attribute "producerstatus" as "down". And I have a entitlement in the consumer side saying "{color:#0000ff}sessionpset\producerstatus is not equal to "down" {color:#000000}which hides the page for the user. Is this the right way to handle this scenario, or am I doing anything wrong here?{color}{color}