portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Spencer <pau...@apache.org>
Subject Re: Please Help: Howto Expire RSS Portlets Programmatically?
Date Tue, 15 Jan 2002 03:15:53 GMT
Craig,
In the case of an RSS feed, I think you can set a expiration date in the 
HTTP header. Thus, the RSS Content can be refreshed every 5 minutes.

You can manually "expire" the "cache" by deleting the related files in 
<jetspeed-home>/WEB-INF/cache


 > 			PortletCache.removeCacheable(cacheKey);
This is just removing the portlet header form the cache, the content is 
still in the disk cache.


Paul Spencer

Setera, Craig wrote:

> Hello all,
> 
> I asked about this once before, but received no response.  Not sure if
> people just don't know the answer or if my original request was missed.
> Hopefully it was the latter and my asking again won't be too much of a
> bother.
> 
> My company is busy building things around the excellent Jetspeed 1.3a2
> release of the portal.  We have built a number of "local" OCS content feeds
> that are managed on the local disk.  In addition, we have built a very
> simple content management front-end to add content to the OCS/RSS stream.
> We would like to be able to flush all of the affected RSS portlets
> immediately following an update to one of the RSS files such that the next
> load of the portlet will show the new/removed items.  Unfortunately, I can't
> seem to get this to work.  I've coded up the following in hopes of clearing
> the changed portlet, but it doesn't seem to work for some reason.
> 
> /**
>  * Flush the cached version of the portlet that wraps
>  * the specified RSS content stream.
>  */
> protected void flushRssPortlet(String rss) {
> 	// Get access the the portlet factory service
> 	ServiceBroker serviceBroker = TurbineServices.getInstance();
> 	PortletFactoryService portletFactory = 
> 		(PortletFactoryService)
> serviceBroker.getService(PortletFactoryService.SERVICE_NAME);
> 
> 	// Look up the portlet in the factory
> 	Portlet portlet = null;
> 	try {
> 		portlet = portletFactory.getPortlet(rss);
> 	} catch (PortletException e) {
> 		// munch
> 	}
> 		
> 	// If we found it, pull its cache key and remove
> 	// it from the caches
> 	if (portlet != null) {
> 		// First, clear the disk cache
> 		String diskCacheURL = portlet.getPortletConfig().getURL();
> 		JetspeedDiskCache.getInstance().refresh(diskCacheURL);
> 			
> 		// Then the portlet cache
> 		if (portlet instanceof Cacheable) {
> 			String cacheKey = ((Cacheable) portlet).getHandle();
> 			
> 			// OK.  We have the cache key now.  Remove from the
> 			// portlet cache
> 			PortletCache.removeCacheable(cacheKey);
> 		}
> 	}
> }
> 
> Part of this *may* be due to the fact that the FileWatcherExpire object does
> not seem to be intialized when the portlet is initially created.
> Unfortunately, even forcing the expire object to be created/initialized
> didn't fix things.
> 
> Can anyone offer any insights or thoughts on how to solve this?  I have run
> out of ideas and could really use some help.
> 
> Thanks,
> Craig
> 
> Craig Setera
> Sun Certified Java Programmer/Developer/Web Component Developer
> Senior Software Architect, Kingland Systems Corporation
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:jetspeed-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:jetspeed-dev-help@jakarta.apache.org>
> 
> 



--
To unsubscribe, e-mail:   <mailto:jetspeed-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:jetspeed-dev-help@jakarta.apache.org>


Mime
View raw message