http://localhost:8080/
NOTE: If working on Alfresco webscripts within the alfresco system, it should be
http://localhost:8080/alfresco/service/
And refresh from there.
Experiences (good and bad) of working with SprinfSurf and Roo in relation to developing Alfresco based applications.
//Define the remove service urlNotice the "<" arrow in the "re" variable for testing whether its an RSS feed or not. It's was round the wrong way.
var newsServiceUrl = "http://www.renewableenergyworld.com/rss/renews.rss";
//Create an instance of remote connector. We will use http type.
var connector = remote.connect("http");
var re = /^http:\/\//;
if (!re.test(newsServiceUrl))
{
newsServiceUrl = "http://" + newsServiceUrl;
}
//Make the HTTP connection.
var result = connector.call(newsServiceUrl);
if (result !== null)
{
//Conver the result into String.
var rssXml = new String(result);
var re = /<[r|R][s|S]{2}/; // Is this really an RSS document?
//Make sure it is a RSS XML document.
if (re.test(rssXml))
{
model.message = "We got into the processing bit";
// Strip out any preceding xml processing instructions or E4X will choke
var idx = rssXml.search(re);
rssXml = rssXml.substring(idx);
// It looks we need to get rid of the trailing junk as well.
if ( rssXml.indexOf('') != -1 ) {
rssXml = rssXml.substring(0,rssXml.indexOf('')+6);
}
// Parse the xml document using E4X APIs.
var rss = new XML(rssXml);
model.title = rss.channel.title.toString();
model.items = [];
var item, obj;
//Loop over all feed items.
for each (item in rss.channel.item)
{
//Retrieve field valuse and populate the JSON object that later will be
//passed on the the view template.
obj = {
"title": item.title.toString(),
"description": item.description.toString(),
"link": item.link.toString()
};
model.items.push(obj);
}
} else {
model.message = "Doesn't work!";
}
}
For some reason the "items?size > 0" does not equate to a true/false expression. It needs to be enclosed in ( ) for it to work.
<#-- end of dashlet -->
${title}
${message}
<#-- end of body -->