Portlet Brodcasting problem.
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > WebSphere > WebSphere Portal Server > Portlet Brodcasting problem.




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Portlet Brodcasting problem.  


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
08-10-04 10:58 PM

I am trying to brodcast a message as a DefaultMessage so the portlet which i
s in another application can receive the same. Portlets which are in the sam
e page are able to receive the message but not in the other application.Tryi
ng to run example in Chapte
r 7 in Portla documentation. Code looks like this.

//Sending the message
public void actionPerformed(ActionEvent event) throws PortletException {
;
if( getPortletLog().isDebugEnabled() )
getPortletLog().debug("ActionListener - actionPerformed called");
// ActionEvent handler
String actionString = event.getActionString();

// Add action string handler here
if(actionString.equalsIgnoreCase(ACTION_RED)){

//	Create the string of HTML to be rendered
String value = "Action <FONT color=\"#ff0000\">RED</FONT>";

//		 Create a portlet request
PortletRequest request = event.getRequest();
// Create an instance of portlet data to store values

PortletData portData = request.getData();

try{
// Save value into portlet data
portData.setAttribute("value", value);
portData.store();
}
catch (AccessDeniedException ade){
}catch (IOException ioe){}

//			Send a portlet message
PortletMessage message = new DefaultPortletMessage(value);
try{
this.getPortletConfig().getContext().send(null,message);

}catch (AccessDeniedException e){}

}


}

//In receiving portlet which is in another application(Both applications are
 in same DefaultEar).

public void messageReceived(MessageEvent event) throws PortletException 
3;
if( getPortletLog().isDebugEnabled() )
getPortletLog().debug("MessageListener - messageReceived called");
// MessageEvent handler
PortletMessage msg = event.getMessage();
// Add PortletMessage handler here
if( msg instanceof DefaultPortletMessage ) {
String messageText = ((DefaultPortletMessage)msg).getMessage();
// Add DefaultPortletMessage handler here
PortletRequest request = event.getRequest();
request.setAttribute("message", messageText);
}
else {
// Add general PortletMessage handler here
}
}

If I put this code in a portlet which runs in same application..then it work
s. Have any idea ?

Thanks.
Sudhakar






[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 10:57 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register