Render parameter issue with processEvent in a remote portlet

classic Classic list List threaded Threaded
4 messages Options
-Terri- -Terri-
Reply | Threaded
Open this post in threaded view
|

Render parameter issue with processEvent in a remote portlet

Hi,

I have 3 simple portlets to test an inter portlet coordination with WSRP (A balance portlet processing events and displaying a balance, a debit portlet publishing a debit event, a credit portlet publishing a credit event).

When i test these 3 portlets in local mode it works well but in remote mode (the 3 portlets in remote) the render parameters set in the balance processEvent method are lost and i can't retreive them neither in the doView method nor in my view jsp.

Here my code for the BalancePortlet :
public class BalancePortlet extends GenericPortlet {
   
    int balance = 2000;
   
        public void processEvent(EventRequest request, EventResponse response)
        {
            Event event = request.getEvent();
            if(event.getName().equals("Debit"))
            {
                Debit payload = (Debit)event.getValue();
                balance = balance - payload.getDebit();

            }
            response.setRenderParameter("balance", new Integer(balance).toString());
        }
       
 
 
    public void doView(RenderRequest request,RenderResponse response) throws PortletException,IOException
    {              
        response.setContentType("text/html");
        PortletRequestDispatcher dispatcher =
                getPortletContext().getRequestDispatcher("/WEB-INF/jsp/BalancePortlet_view.jsp");
        dispatcher.include(request, response);
    }

And my jsp :

<%@page import="javax.portlet.*,java.util.*"%>
<%@ page session="false" %>
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>

<portlet:defineObjects />
<p>

BALANCE PORTLET

</p>
<%
String balance = renderRequest.getParameter("balance");

if (balance.equals("") ){%>
<p>2000</p>
<%} else {%>
<p>
Balance : <%=balance%><br/>
</p>
<% } %>


Why the behaviour is different between the local context and the remote context for the processEvent?
For the processAction method it works both in local and remote.
Rajesh T Rajesh T
Reply | Threaded
Open this post in threaded view
|

Re: Render parameter issue with processEvent in a remote portlet


On 21-Jan-10, at 10:57 PM, -Terri- wrote:

>
> Hi,
>
> I have 3 simple portlets to test an inter portlet coordination with  
> WSRP (A
> balance portlet processing events and displaying a balance, a debit  
> portlet
> publishing a debit event, a credit portlet publishing a credit event).
>
> When i test these 3 portlets in local mode it works well but in  
> remote mode
> (the 3 portlets in remote) the render parameters set in the balance
> processEvent method are lost and i can't retreive them neither in  
> the doView
> method nor in my view jsp.
>
> Here my code for the BalancePortlet :
> public class BalancePortlet extends GenericPortlet {
>
>     int balance = 2000;
>
>         public void processEvent(EventRequest request, EventResponse
> response)
>         {
>             Event event = request.getEvent();
>             if(event.getName().equals("Debit"))
>             {
>                 Debit payload = (Debit)event.getValue();
>                 balance = balance - payload.getDebit();
>
>             }
>             response.setRenderParameter("balance", new
> Integer(balance).toString());
>         }
>
>
>
>     public void doView(RenderRequest request,RenderResponse  
> response) throws
> PortletException,IOException
>     {
>         response.setContentType("text/html");
>         PortletRequestDispatcher dispatcher =
>
> getPortletContext().getRequestDispatcher("/WEB-INF/jsp/
> BalancePortlet_view.jsp");
>         dispatcher.include(request, response);
>     }
>
> And my jsp :
>
> <%@page import="javax.portlet.*,java.util.*"%>
> <%@ page session="false" %>
> <%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
>
> <portlet:defineObjects />
> <p><h1>BALANCE PORTLET</h1></p>
> <%
> String balance = renderRequest.getParameter("balance");
>
> if (balance.equals("") ){%>
> <p>2000</p>
> <%} else {%>
> <p>
> Balance : <%=balance%><br/>
> </p>
> <% } %>
>
>
> Why the behaviour is different between the local context and the  
> remote
> context for the processEvent?
> For the processAction method it works both in local and remote.

Sorry for the delayed response, Which version of webspace  you are  
using ? The behavior should be same for both local and remote modes.

Could you also try the same portlets with OpenPortal WSRP (https://
wsrp.dev.java.net/public/Download.html)  It'll be easier to deploy  
and debug the issue with it.

regards
Rajesh T



> --
> View this message in context: http://n2.nabble.com/Render-parameter- 
> issue-with-processEvent-in-a-remote-portlet-tp4435066p4435066.html
> Sent from the Development mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

-Terri- -Terri-
Reply | Threaded
Open this post in threaded view
|

Re: Render parameter issue with processEvent in a remote portlet

Hi,

I try to put the three portlets in the same project and deploy it on OpenPortal 2.1 with WSRP 2.0 and the eventing coordination works both in local and remote mode. So i try to deploy this project on WebSpace 10.0 and it works too.


With both OpenPortal and WebSpace, when i build three different projects one for each portlet. I can publish and process event in local mode (I have tested with the three portlets in local mode). But in remote mode i can only publish events my balance portlet doesn't process the event. I put some println in the processEvent method but they aren't prompted in the console (I have deleted the portlet windows in local mode to have only the three portlets in remote mode)
So i have tested with my balance portlet in local mode and my debit and credit portlets in remote mode and it works. My events published in remote mode are processed in local mode.


So we can't process events from different context in remote mode?
Can i deploy portlets from different project in the same context on WebSpace or OpenPortal?

(I develop my projects on Netbeans 6.5)
Rajesh T Rajesh T
Reply | Threaded
Open this post in threaded view
|

Re: Render parameter issue with processEvent in a remote portlet

Thanks for the detailed response. Pls see inline


On 26-Jan-10, at 7:49 PM, -Terri- wrote:

>
> Hi,
>
> I try to put the three portlets in the same project and deploy it on
> OpenPortal 2.1 with WSRP 2.0 and the eventing coordination works  
> both in
> local and remote mode. So i try to deploy this project on WebSpace  
> 10.0 and
> it works too.
>
>
> With both OpenPortal and WebSpace, when i build three different  
> projects one
> for each portlet. I can publish and process event in local mode (I  
> have
> tested with the three portlets in local mode). But in remote mode i  
> can only
> publish events my balance portlet doesn't process the event. I put  
> some
> println in the processEvent method but they aren't prompted in the  
> console
> (I have deleted the portlet windows in local mode to have only the  
> three
> portlets in remote mode)
> So i have tested with my balance portlet in local mode and my debit  
> and
> credit portlets in remote mode and it works. My events published in  
> remote
> mode are processed in local mode.
>
>
> So we can't process events from different context in remote mode?

No, It should behave the same from within the same context and  
different context. Sounds like a bug when portlets with different  
cotexts are used.

> Can i deploy portlets from different project in the same context on  
> WebSpace
> or OpenPortal?

Yes you can bundle multiple portlets within the same war and deploy  
it to Webspace - Hope this workaround should fix your issue

regards
Rajesh T


>
> (I develop my projects on Netbeans 6.5)
> --
> View this message in context: http://n2.nabble.com/Render-parameter- 
> issue-with-processEvent-in-a-remote-portlet-tp4435066p4460849.html
> Sent from the Development mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]