Skip to content

Commit 2023be0

Browse files
author
Pascal Robert
committed
Addind a RSS feed for blog entries
1 parent ce53346 commit 2023be0

File tree

10 files changed

+60
-2
lines changed

10 files changed

+60
-2
lines changed

SimpleBlog/.classpath

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
<classpathentry kind="con" path="WOFramework/JavaJDBCAdaptor"/>
2222
<classpathentry kind="con" path="WOFramework/JavaEOProject"/>
2323
<classpathentry kind="con" path="WOFramework/Ajax"/>
24-
<classpathentry kind="con" path="WOFramework/WOLips"/>
2524
<classpathentry kind="con" path="WOFramework/SimpleBlogLogic"/>
2625
<classpathentry kind="con" path="WOFramework/ERRest"/>
2726
<classpathentry kind="con" path="WOFramework/H2PlugIn"/>
2827
<classpathentry kind="con" path="WOFramework/WOOgnl"/>
28+
<classpathentry kind="con" path="WOFramework/WOLips"/>
2929
<classpathentry kind="output" path="bin"/>
3030
</classpath>

SimpleBlog/Components/PublicWrapper.wo/PublicWrapper.html

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<head>
44
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
55
<title><wo:str value="$pageTitle" /></title>
6+
<wo:WOGenericElement elementName = "link" rel="alternate" type="application/rss+xml" title="RSS" href = "$linkToRssFeed" />
67
</head>
78
<body> <wo:WOComponentContent /> </body>
89
</html>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<webobject name = "ListingFeeds"><wo:WOString value = "$item.title" /></webobject>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
ListingFeeds : ERXRssPage {
2+
list = blogEntries;
3+
item = item;
4+
feedTitle = "RSS feed for this site";
5+
feedDescription = "RSS feed for this site";
6+
feedLanguage = "en-us";
7+
feedUrl = "http://www.wocommunity.org";
8+
feedCopyright = "&#x2117; &amp; &#xA9; 2009 WebObjects Community Association and presenters";
9+
feedAuthor = "WebObjects Community Association";
10+
feedImageUrl = "http://www.wocommunity.org/images/wo.png";
11+
feedCategory = "Technology";
12+
feedOwnerEmail = "[email protected]";
13+
feedOwnerName = "WebObjects Community Association";
14+
itemTitle = item.title;
15+
itemAuthor = item.person.fullName;
16+
itemGuid = linkToPost;
17+
itemPubDate = item.lastModifed;
18+
itemLink = linkToPost;
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"WebObjects Release" = "WebObjects 5.0";
3+
encoding = "UTF-8";
4+
}

SimpleBlog/Resources/Properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ er.migration.createTablesIfNecessary=true
5252
#er.extensions.ERXWORepetition.raiseOnUnmatchedObject=true
5353
#er.extensions.ERXWORepetition.eoSupport=true
5454

55-
er.component.clickToOpen=true
55+
er.component.clickToOpen=false
5656
wolips.password=my_password
5757

5858
# ERJavaMail

SimpleBlog/Sources/com/wowodc/app/Application.java

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import com.wowodc.model.BlogEntry;
99
import com.wowodc.model.Person;
1010
import com.wowodc.rest.controllers.OtherRoutesController;
11+
import com.wowodc.rest.controllers.RssController;
1112

1213
import er.extensions.appserver.ERXApplication;
1314
import er.extensions.appserver.navigation.ERXNavigationManager;
@@ -37,6 +38,7 @@ public Application() {
3738
restRequestHandler.addDefaultRoutes(Person.ENTITY_NAME);
3839
restRequestHandler.insertRoute(new ERXRoute("Other", "", ERXRoute.Method.Get, OtherRoutesController.class, "mainPage"));
3940
restRequestHandler.insertRoute(new ERXRoute("Other", "/admin", ERXRoute.Method.Get, OtherRoutesController.class, "adminPage"));
41+
restRequestHandler.insertRoute(new ERXRoute("Rss", "/rsses/main", ERXRoute.Method.Get, RssController.class, "main"));
4042

4143
ERXRouteRequestHandler.register(restRequestHandler);
4244

SimpleBlog/Sources/com/wowodc/rest/controllers/OtherRoutesController.java

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import com.webobjects.appserver.WORequest;
55
import com.wowodc.ui.components.BlogEntryIndexPage;
66
import com.wowodc.ui.components.Main;
7+
import com.wowodc.ui.components.RssFeedPage;
78

89
import er.rest.format.ERXRestFormat;
910

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.wowodc.rest.controllers;
2+
3+
import com.webobjects.appserver.WOActionResults;
4+
import com.webobjects.appserver.WORequest;
5+
import com.wowodc.ui.components.RssFeedPage;
6+
7+
import er.rest.format.ERXRestFormat;
8+
9+
public class RssController extends BaseRestController {
10+
11+
public RssController(WORequest request) {
12+
super(request);
13+
}
14+
15+
public WOActionResults mainAction() {
16+
return pageWithName(RssFeedPage.class);
17+
}
18+
19+
@Override
20+
protected ERXRestFormat defaultFormat() {
21+
return ERXRestFormat.xml();
22+
}
23+
24+
}

SimpleBlog/Sources/com/wowodc/ui/components/PublicWrapper.java

+6
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import com.webobjects.appserver.WOContext;
44

55
import er.extensions.components.ERXStatelessComponent;
6+
import er.rest.format.ERXRestFormat;
7+
import er.rest.routes.ERXRouteUrlUtils;
68

79
public class PublicWrapper extends ERXStatelessComponent {
810

@@ -15,4 +17,8 @@ public String pageTitle() {
1517
return (String)pageTitle;
1618
}
1719

20+
public String linkToRssFeed() {
21+
return ERXRouteUrlUtils.actionUrlForEntityType(this.context(), "Rss", "main", ERXRestFormat.xml().name(), null, false, false);
22+
}
23+
1824
}

0 commit comments

Comments
 (0)