You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-user@portals.apache.org by Church Michael R <MR...@qinetiq.com> on 2006/01/30 17:42:55 UTC

Jetspeed 2 - Auto-refreshing Portlets

> > Also, I want the contents of my portlet to automatically refresh itself
> > every 60 seconds or so. How would I achieve this? I thought the rss::RSS
> > example portlet might do this (to refresh the RSS newsfeed every 3600
> > seconds, as it's supposed to do), but it appears that it doesn't do
> that.
> >
> You can build this into your portlet using your own timer
> The RSS portlets do have a refresh timer on them
> 		<preference>
> 			<name>minrefresh</name>
> 			<value>3600</value>
> 		</preference>

Being a total newbie to all of this, I'm not entirely sure what you mean. I
thought that servlets (and thus portlets) are not able to "push" HTML
content to the client, indeed that clients had to "pull" content from the
servlets by issuing careful refresh requests. Am I wrong? Has the technology
moved on from that restriction?

In any case, looking at the source code for the example rss::RSS portlet, I
notice that the "minrefresh" preference is not used in the portlet itself.
Nor does "minrefresh" appear in the HTML fragment that renders the RSS
portlet. So I fail to see how "minrefresh" is being used at all (in the
rss::RSS example portlet).

Is there any practical example that could show me exactly what to do to
create a self-refreshing portlet? By way of example, perhaps a very simple
portlet that reports the current time of day at the server?

Thanks,
Mike





Mike Church
Software Engineering

QinetiQ
Bldg Lovell Rm 109
Malvern Technology Centre
St. Andrews Road, Malvern
Worcestershire, WR14 3PS

Tel:    01684 896085
Email:  mrchurch@QinetiQ.com
Web:    www.QinetiQ.com

QinetiQ - The Global Defence and Security Experts.

The Information contained in this E-Mail and any subsequent correspondence
is private and is intended solely for the intended recipient(s).
For those other than the recipient any disclosure, copying, distribution,
or any action taken or omitted to be taken in reliance on such information
is prohibited and may be unlawful.

Emails and other electronic communication with QinetiQ may be monitored.
Calls to QinetiQ may be recorded for quality control,
regulatory and monitoring purposes.

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org


Re: Jetspeed 2 - Auto-refreshing Portlets

Posted by David Sean Taylor <da...@bluesunrise.com>.
Church Michael R wrote:
>>>Also, I want the contents of my portlet to automatically refresh itself
>>>every 60 seconds or so. How would I achieve this? I thought the rss::RSS
>>>example portlet might do this (to refresh the RSS newsfeed every 3600
>>>seconds, as it's supposed to do), but it appears that it doesn't do
>>
>>that.
>>
>>You can build this into your portlet using your own timer
>>The RSS portlets do have a refresh timer on them
>>		<preference>
>>			<name>minrefresh</name>
>>			<value>3600</value>
>>		</preference>
> 
> 
> Being a total newbie to all of this, I'm not entirely sure what you mean. I
> thought that servlets (and thus portlets) are not able to "push" HTML
> content to the client, indeed that clients had to "pull" content from the
> servlets by issuing careful refresh requests. Am I wrong? Has the technology
> moved on from that restriction?

The content is being pulled by the portlet from an RSS source.
(Im looking into contributing push technology for jetspeed soon)

> 
> In any case, looking at the source code for the example rss::RSS portlet, I
> notice that the "minrefresh" preference is not used in the portlet itself.
> Nor does "minrefresh" appear in the HTML fragment that renders the RSS
> portlet. So I fail to see how "minrefresh" is being used at all (in the
> rss::RSS example portlet).

Yup you're right. Surprising but this simple feature slipped through 
unnoticed. Seems like I hard-coded the time to live at 15 minutes
See RssPortlet.java

                 cache.put(key, sw.toString().getBytes("UTF-8"), 15); 


I'll make this more configurable, easy enough to configure it from the 
portlet.xml.

> 
> Is there any practical example that could show me exactly what to do to
> create a self-refreshing portlet? By way of example, perhaps a very simple
> portlet that reports the current time of day at the server?

The RSS portlet is one example of using a cache and updating every 15 
minutes. Its an example of content being pulled by a portlet from an RSS 
feed at a 15 minute interval.

Or do you mean refreshing itself from Javascript on the clientside?

Jetspeed has an Ajax pipeline, you could hook into that pretty easily.
Ive written quite a portlets to do that for clients.
I don't have any examples in Jetspeed though. Prefer to formalize the 
API a  bit more before committing


---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org