<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%> <%@ taglib uri='WEB-INF/tlds/database.tld' prefix='database'%> <%@ page import="java.util.*,java.io.*,javax.xml.parsers.*,java.net.*,org.gnu.stealthp.rsslib.*" %> <% /** * @version 1 2005-08-04 * @author Jon Corson-Rikert * * CHANGE HISTORY * 2005-08-18 jc55 added "raw" mode for inclusion in tabs */ final int DEFAULT_PORTAL_ID=1; String portalIdStr=(portalIdStr=request.getParameter("home"))==null?String.valueOf(DEFAULT_PORTAL_ID): portalIdStr.equals("")?String.valueOf(DEFAULT_PORTAL_ID):portalIdStr; int incomingPortalId=Integer.parseInt(portalIdStr); final String DEFAULT_RSS_URL="http://www.nsf.gov/mynsf/RSS/rss2news.xml"; //http://www.nsf.gov/mynsf/RSS/rss2discoveries.xml boolean includeHeaders=true; String rawStr=(rawStr=request.getParameter("raw"))==null?"false": rawStr.equals("")?"false":rawStr; if (rawStr!=null && rawStr.equalsIgnoreCase("true")) { includeHeaders=false; } if (includeHeaders) {%> RSS <% final String DEFAULT_APPNAME="RSS"; final String DEFAULT_STYLESHEET="portal"; String appName=DEFAULT_APPNAME; String styleSheet=DEFAULT_STYLESHEET;%> SELECT appName,styleSheet FROM portals WHERE id='<%=portalIdStr%>' <% int portal_col=0; %> <% switch (portal_col) { case 0: appName=theValue; break; case 1: styleSheet="portal"; break; } ++portal_col; %> <% }%> <% if (includeHeaders) {%> <% } %> <% if (includeHeaders) {%> <% }%>
<% String noisyStr=(noisyStr=(String)request.getAttribute("noisy"))==null || noisyStr.equals("")?((noisyStr=request.getParameter("noisy"))==null || noisyStr.equals("")?"false":noisyStr):noisyStr; boolean NOISY=(noisyStr.equalsIgnoreCase("true"))?true:false; String urlStr=(urlStr=(String)request.getAttribute("url"))==null || urlStr.equals("")?((urlStr=request.getParameter("url"))==null || urlStr.equals("")?DEFAULT_RSS_URL:urlStr):urlStr; if (urlStr==null || urlStr.equals("")) {%>

Error in URL parameter

System could not decode <%=urlStr%> as a URL

<% } else { URL u=null; try { u = new URL(urlStr); RSSHandler hand=new RSSHandler(); try { RSSParser.parseXmlFile(u,hand,false); RSSChannel ch= hand.getRSSChannel();%>

<%=ch.getTitle()%>

<% String lastDateStr=ch.getLastBuildDate(); if (lastDateStr==null || lastDateStr.equals("")) { RSSDoublinCoreModule dcModule=ch.getRSSDoublinCoreModule(); if (dcModule!=null){ lastDateStr=dcModule.getDcDate(); if (lastDateStr!=null && !lastDateStr.equals("")){ int timeStartPos=lastDateStr.indexOf("T"); int timeEndPos=lastDateStr.indexOf("Z"); if (timeStartPos>0 && timeEndPos>0){ %>

listings current as of <%=lastDateStr.substring(0,timeStartPos)%> at <%=lastDateStr.substring(timeStartPos+1,timeEndPos)%>

<% } else {%>

listings current as of: <%=lastDateStr%>

<% } } else {%>

RSSDoublinCoreModule.getDcDate() returns null or blank String

<% } } else {%>

RSSDoublinCoreModule is null

<% } } String copyrightStr=ch.getCopyright(); if (copyrightStr!=null && !copyrightStr.equals("")){%>

<%=ch.getCopyright()%>

<% } if (NOISY && ch.getRSSImage()!=null) {%>

IMAGE INFO:
<%=ch.getRSSImage().toString()%>

IMAGE IN HTML:
<%=ch.getRSSImage().toHTML()%>

<% } else if (NOISY) {%>

CHANNEL HAS NO IMAGE

<% } if (NOISY && ch.getRSSTextInput()!=null) {%>

INPUT INFO:
<%=ch.getRSSTextInput().toString()%>

HTML INPUT:
<%=ch.getRSSTextInput().toHTML()%>

<% } else if (NOISY) {%>

CHANNEL HAS NO FORM INPUT

<% } if (NOISY && ch.getDoublinCoreElements()!=null) {%>

DUBLIN CORE INFO:
<%=ch.getDoublinCoreElements().toString()%>

<% } else if (NOISY) {%>

CHANNEL HAS NO DUBLIN CORE TAGS

<% }%> <% if (NOISY) {%>

SEQUENCE INFO

<% if (ch.getItemsSequence()!=null) {%>

<%=hand.getRSSChannel().getItemsSequence().toString()%>

<% } else if (NOISY) {%>

CHANNEL HAS NO SEQUENCE; MAYBE VERSION 0.9 or 2+?

<% } } LinkedList lst = hand.getRSSChannel().getItems();%>

ITEMS INFO (<%=lst.size()%>)

    <% for (int i = 0; i < lst.size(); i++){ RSSItem itm = (RSSItem)lst.get(i);%>
  • <%=itm.toString()%>
  • <% if (itm.getDoublinCoreElements()!=null) {%>
    DUBLIN CORE INFO FOR ITEM: <%=itm.getDoublinCoreElements().toString()%> <% } else if (NOISY) {%>
    ITEM HAS NO DUBLIN CORE TAGS <% }%> <% } // end for } catch (org.gnu.stealthp.rsslib.RSSException ex) {%>

    error initializing RSSHandler

    <%=ex.getMessage()%>

    <% } } catch (java.net.MalformedURLException ex) {%>

    Error in URL parameter

    System could not convert <%=urlStr%> to a Java URL: <%=ex.getMessage()%>

    <% } } // end else URLstr not null or blank%>
<% if (includeHeaders) {%> <% }%>