[jboss-cvs] jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/util ...
Christian Bauer
christian at hibernate.org
Mon Jan 14 00:10:48 EST 2008
User: cbauer
Date: 08/01/14 00:10:48
Modified: examples/wiki/src/main/org/jboss/seam/wiki/util
WikiUtil.java
Log:
JBSEAM-2457 - Render "REST" feed/file download URLs, breaks all current feed/file bookmarks
Revision Changes Path
1.26 +15 -3 jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/util/WikiUtil.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: WikiUtil.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/util/WikiUtil.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -b -r1.25 -r1.26
--- WikiUtil.java 11 Jan 2008 00:09:17 -0000 1.25
+++ WikiUtil.java 14 Jan 2008 05:10:48 -0000 1.26
@@ -9,9 +9,8 @@
import org.jboss.seam.Component;
import org.jboss.seam.security.Identity;
import org.jboss.seam.wiki.core.action.prefs.WikiPreferences;
-import org.jboss.seam.wiki.core.model.Role;
-import org.jboss.seam.wiki.core.model.User;
-import org.jboss.seam.wiki.core.model.WikiNode;
+import org.jboss.seam.wiki.core.model.*;
+import org.jboss.seam.wiki.core.ui.FeedServlet;
import org.jboss.seam.wiki.preferences.Preferences;
import javax.faces.context.FacesContext;
@@ -79,6 +78,19 @@
);
}
+ public static String renderFeedURL(Feed feed, String tag, String comments) {
+ if (feed == null || feed.getId() == null) return "";
+ StringBuilder url = new StringBuilder();
+ url.append(Component.getInstance("basePath")).append("/service/Feed/atom").append(feed.getURL());
+ if (comments != null && comments.length() >0) {
+ try {
+ url.append("/Comments/").append(FeedServlet.Comments.valueOf(comments));
+ } catch (IllegalArgumentException ex) {}
+ }
+ if (tag != null && tag.length() >0) url.append("/Tag/").append(encodeURL(tag));
+ return url.toString();
+ }
+
public static String renderURL(WikiNode node) {
if (node == null || node.getId() == null) return "";
WikiPreferences wikiPrefs = (WikiPreferences) Preferences.getInstance("Wiki");
More information about the jboss-cvs-commits
mailing list