我有一个名为“news_feed_backend”的网络服务和一个名为“news_feed_frontend”的活动资源客户端,我想调用“news_feed_backend”控制器的索引操作,它实际上在客户端以xml格式呈现新闻提要(news_feed_frontend broswer),我只是不知道我将如何完成它。我的 news_feed_backend 控制器如下:
# Load an RSS feed from the supplied URL. If the feed is not loaded, return nil.
def load_latest_news_feed_for_url(rss_feed_url_to_load)
to_return = nil
if rss_feed_url_to_load != nil
begin
to_return = RSS::Parser.parse(open(rss_feed_url_to_load).read, false).items[0...5]
rescue
to_return = nil
end
end
to_return
end
def index
@fd = FeedDetail.new
@url = @fd.get()
@news_feed = load_latest_news_feed_for_url(@url)
render :xml => @news_feed, :content_type => 'application/rss'
end
我在我的 news_feed_frontend 的(客户端)控制器中尝试这样的事情:
def index
url_for :controller => 'feed_details', :action => 'index'
end