rss.jsp revision 85f619afce0f5860dd3265e1ac5c48efcb353921
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo SirainenCDDL HEADER START
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo SirainenThe contents of this file are subject to the terms of the
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo SirainenCommon Development and Distribution License (the "License").
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo SirainenYou may not use this file except in compliance with the License.
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo SirainenSee LICENSE.txt included in this distribution for the specific
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenlanguage governing permissions and limitations under the License.
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo SirainenWhen distributing Covered Code, include this CDDL HEADER in each
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenfile and include the License file at LICENSE.txt.
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo SirainenIf applicable, add the following below this CDDL HEADER, with the
f16c114c20bbd7d292d93415d1e56c8dd6abd3e7Timo Sirainenfields enclosed by brackets "[]" replaced with your own identifying
f16c114c20bbd7d292d93415d1e56c8dd6abd3e7Timo Siraineninformation: Portions Copyright [yyyy] [name of copyright owner]
f16c114c20bbd7d292d93415d1e56c8dd6abd3e7Timo SirainenCDDL HEADER END
f16c114c20bbd7d292d93415d1e56c8dd6abd3e7Timo SirainenCopyright 2005 Sun Microsystems, Inc. All rights reserved.
f16c114c20bbd7d292d93415d1e56c8dd6abd3e7Timo SirainenUse is subject to license terms.
f16c114c20bbd7d292d93415d1e56c8dd6abd3e7Timo Sirainenident "@(#)rss.jsp 1.2 05/12/02 SMI"
f16c114c20bbd7d292d93415d1e56c8dd6abd3e7Timo Sirainen--%><%@ page import = "javax.servlet.*,
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen%><%@ page session="false" %><%@ page errorPage="error.jsp"%><%
84e1634acc701d14e358e27f1beff5ad74f5004aTimo SirainenString context = request.getContextPath();
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo SirainenString servlet = request.getServletPath();
98c1cf256927e254f0c092acd2ddcd7ea50bd009Timo SirainenString reqURI = request.getRequestURI();
8fcff4c5b52f24d9c681805fdf06b486f1d0fcbeTimo Sirainenif(path == null) path = "";
8fcff4c5b52f24d9c681805fdf06b486f1d0fcbeTimo Sirainen path = URLDecoder.decode(path, "ISO-8859-1");
9aa52288a4b53186d81b0ec9afa7d9e0a8ee8753Timo Sirainen } catch (UnsupportedEncodingException e) {
e06c0b65c16ccce69bbee009ead14d7d3d17a256Timo SirainenRuntimeEnvironment env = RuntimeEnvironment.getInstance();
7a6b45405fb1544ac476e6eb1402a70cc1ddcdcfTimo Sirainenenv.setUrlPrefix(context + "/s?");
8fcff4c5b52f24d9c681805fdf06b486f1d0fcbeTimo SirainenString rawSource = env.getSourceRootPath();
8fcff4c5b52f24d9c681805fdf06b486f1d0fcbeTimo SirainenString resourcePath = rawSource + path;
98c1cf256927e254f0c092acd2ddcd7ea50bd009Timo SirainenFile resourceFile = new File(resourcePath);
f7d43647acc6dc80064c8c4cacf5bf86f754c530Timo Sirainenboolean valid;
98c1cf256927e254f0c092acd2ddcd7ea50bd009Timo SirainenString basename = resourceFile.getName();
98c1cf256927e254f0c092acd2ddcd7ea50bd009Timo Sirainenif("/".equals(path)) {
98c1cf256927e254f0c092acd2ddcd7ea50bd009Timo Sirainen basename = "Cross Reference";
98c1cf256927e254f0c092acd2ddcd7ea50bd009Timo Sirainenboolean isDir = false;
a2637488c8d514ec1ac3914811deee814f9761b3Timo SirainenString parent = null;
a2637488c8d514ec1ac3914811deee814f9761b3Timo SirainenString parentBasename = resourceFile.getParentFile().getName();
a2637488c8d514ec1ac3914811deee814f9761b3Timo SirainenIgnoredNames ignoredNames = env.getIgnoredNames();
a2637488c8d514ec1ac3914811deee814f9761b3Timo Sirainen|| ignoredNames.ignore(basename) || ignoredNames.ignore(parentBasename)) {
a2637488c8d514ec1ac3914811deee814f9761b3Timo Sirainen valid = false;
a2637488c8d514ec1ac3914811deee814f9761b3Timo Sirainen valid = true;
a2637488c8d514ec1ac3914811deee814f9761b3Timo Sirainen path = resourcePath.substring(rawSource.length());
a2637488c8d514ec1ac3914811deee814f9761b3Timo Sirainen path = path.replace('\\','/');
1d2b188f0eedc3cab6e27ceac5425a037f38042eTimo Sirainen if (isDir && !reqURI.endsWith("/")) {
a2637488c8d514ec1ac3914811deee814f9761b3Timo Sirainen response.sendRedirect(context + servlet + path +"/");
a2637488c8d514ec1ac3914811deee814f9761b3Timo Sirainen String dtag = "";
02b79f9c2636da1829eee5b92753602bba8b67edTimo Sirainen EftarFileReader ef = new EftarFileReader(env.getDataRootPath() + "/index/dtags.eftar");
a2637488c8d514ec1ac3914811deee814f9761b3Timo Sirainen dtag = ef.get(path);
1d2b188f0eedc3cab6e27ceac5425a037f38042eTimo Sirainen } catch (Exception e) {
02b79f9c2636da1829eee5b92753602bba8b67edTimo Sirainen int lastSlash = path.lastIndexOf('/');
02b79f9c2636da1829eee5b92753602bba8b67edTimo Sirainen parent = (lastSlash != -1) ? path.substring(0, lastSlash) : "";
02b79f9c2636da1829eee5b92753602bba8b67edTimo Sirainen int pLastSlash = parent.lastIndexOf('/');
a2637488c8d514ec1ac3914811deee814f9761b3Timo Sirainen parentBasename = pLastSlash != -1 ? parent.substring(pLastSlash+1) : parent;
299183fbb6ec5d0828a0880da372540421ac4665Timo Sirainen Date start = new Date();
299183fbb6ec5d0828a0880da372540421ac4665Timo Sirainen%><?xml version="1.0"?>
a2637488c8d514ec1ac3914811deee814f9761b3Timo Sirainen<?xml-stylesheet type="text/xsl" href="<%=context%>/rss.xsl.xml"?>
a2637488c8d514ec1ac3914811deee814f9761b3Timo Sirainen<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
299183fbb6ec5d0828a0880da372540421ac4665Timo Sirainen <title>Changes in <%=basename%></title>
a2637488c8d514ec1ac3914811deee814f9761b3Timo Sirainen <link><%=request.getRequestURL()%></link>
299183fbb6ec5d0828a0880da372540421ac4665Timo Sirainen <description><%=dtag%></description>
299183fbb6ec5d0828a0880da372540421ac4665Timo Sirainen <language>en</language>
299183fbb6ec5d0828a0880da372540421ac4665Timo Sirainen <copyright>Copyright 2005</copyright>
299183fbb6ec5d0828a0880da372540421ac4665Timo Sirainen <generator>Java</generator>
a2637488c8d514ec1ac3914811deee814f9761b3Timo Sirainen Format df = new SimpleDateFormat("dd-MMM-yyyy");
299183fbb6ec5d0828a0880da372540421ac4665Timo Sirainen HistoryReader hr = null;
299183fbb6ec5d0828a0880da372540421ac4665Timo Sirainen String[] apaths = request.getParameterValues("also");
299183fbb6ec5d0828a0880da372540421ac4665Timo Sirainen String apath = path;
299183fbb6ec5d0828a0880da372540421ac4665Timo Sirainen if (apaths!= null && apaths.length>0) {
299183fbb6ec5d0828a0880da372540421ac4665Timo Sirainen StringBuilder paths = new StringBuilder(path);
299183fbb6ec5d0828a0880da372540421ac4665Timo Sirainen for(int i=0; i< apaths.length; i++) {
299183fbb6ec5d0828a0880da372540421ac4665Timo Sirainen hr = new DirectoryHistoryReader(apath);
299183fbb6ec5d0828a0880da372540421ac4665Timo Sirainen File f = new File(rawSource + parent, basename);
299183fbb6ec5d0828a0880da372540421ac4665Timo Sirainen hr = HistoryGuru.getInstance().getHistoryReader(f);
dda2c506c8fc8ac2f88272de4523ded42baa0aa0Timo Sirainen if (hr != null) {
313fe89df4d91cd0cd7f3558dc6d7fd21ad39eeeTimo Sirainen while (hr.next() && i-- > 0) {
9e59a1f3f095b3099478562cf3f3970a24736970Timo Sirainen String rev = hr.getRevision();
dda2c506c8fc8ac2f88272de4523ded42baa0aa0Timo Sirainen <title><%=Util.Htmlize(hr.getComment())%></title>
2e937ed8585299b2e879a28314902a5f644813d2Timo Sirainen <description><%
313fe89df4d91cd0cd7f3558dc6d7fd21ad39eeeTimo Sirainen List<String> files = hr.getFiles();
dda2c506c8fc8ac2f88272de4523ded42baa0aa0Timo Sirainen if(files != null) {
313fe89df4d91cd0cd7f3558dc6d7fd21ad39eeeTimo Sirainen for (String ifile : files) {
313fe89df4d91cd0cd7f3558dc6d7fd21ad39eeeTimo Sirainen %><%=path%> - <%=hr.getRevision()%><%
4d25408732be27e91f0430f71e87242760c2517cTimo Sirainen %></description>
c3412ddeb9abc13f99d3caf50faf76cd99f7e9d2Timo Sirainen <pubDate><%=hr.getDate()%></pubDate>
313fe89df4d91cd0cd7f3558dc6d7fd21ad39eeeTimo Sirainen <dc:creator><%=hr.getAuthor()%></dc:creator>
1e76a5b92f9d82d557f81f080f3dfad1c9d8f200Timo Sirainen%></channel></rss>