Author: tyrell
Date: Wed Jan 23 18:40:57 2008
New Revision: 12786
Log:
Changing the live announcements fetching mechanism to use a jsp bean stored in
the application scope.
Modified:
trunk/mashup/java/modules/core/src/org/wso2/mashup/webapp/utils/RegistryUtils.java
trunk/mashup/java/modules/www/taskbar.jsp
Modified:
trunk/mashup/java/modules/core/src/org/wso2/mashup/webapp/utils/RegistryUtils.java
==============================================================================
---
trunk/mashup/java/modules/core/src/org/wso2/mashup/webapp/utils/RegistryUtils.java
(original)
+++
trunk/mashup/java/modules/core/src/org/wso2/mashup/webapp/utils/RegistryUtils.java
Wed Jan 23 18:40:57 2008
@@ -694,12 +694,11 @@
/**
- * Gets product and version specific announcements from the pre determined
URL
+ * Gets a product and version specific announcements URL.
*
- * @return A string containing the announcement as HTML content, plugable
to a DIV in the UI. Can be blank.
+ * @return A string containing the announcement URL
*/
- public static String getAnnouncements() {
- String response = "";
+ public static String getAnnouncementsUrl() {
//Getting the server version from server.xml
ServerConfiguration serverConfig = ServerConfiguration.getInstance();
@@ -707,13 +706,7 @@
serverConfig
.getFirstProperty(MashupConstants.MASHUP_SERVER_VERSION);
- String url = "http://wso2.com/announcements/mashup/" + serverVersion +
"/index.html";
+ return "http://wso2.com/announcements/mashup/" + serverVersion +
"/index.html";
- Announcement announcementFetcher = new Announcement();
- if ((response = announcementFetcher.get(url)) == null) {
- response = "";
- }
-
- return response;
}
}
Modified: trunk/mashup/java/modules/www/taskbar.jsp
==============================================================================
--- trunk/mashup/java/modules/www/taskbar.jsp (original)
+++ trunk/mashup/java/modules/www/taskbar.jsp Wed Jan 23 18:40:57 2008
@@ -39,6 +39,8 @@
<%@ page import="java.net.URLEncoder" %>
<%@ page import="java.util.*" %>
+<jsp:useBean id="announcementsFetcher"
class="org.wso2.registry.announcement.Announcement" scope="application"/>
+
<%
ResourceBundle bundle = ResourceBundle.getBundle("UI");
//Setting variables required for the taskbar.jsp
@@ -314,10 +316,17 @@
</li>
<li>
<a href="http://wso2.com/support/mashup">Get Support</a>
- </li>
+ </li>
</ul>
</div>
<div class="rbbot"><div class="bg"><div class="rbFooter"></div></div></div>
</div>
-<div id="announcements"><%=RegistryUtils.getAnnouncements()%></div>
+<%
+ //Preprocessing fetched announcements to check for null
+ String announcement =
announcementsFetcher.get(RegistryUtils.getAnnouncementsUrl());
+ if (announcement == null) {
+ announcement = "";
+ }
+%>
+<div id="announcements"><%=announcement%></div>
_______________________________________________
Mashup-dev mailing list
[email protected]
http://www.wso2.org/cgi-bin/mailman/listinfo/mashup-dev