Apache Nutch is an extensible and scalable web crawler
NUTCH-1700 Remove deprecated code from creativecommons plugin
Lewis John McGibbney48a5be3ecc10
diff --git a/CHANGES.txt b/CHANGES.txtindex 94aee87d8..1471eea39 100644--- a/CHANGES.txt+++ b/CHANGES.txt@@ -2,6 +2,8 @@ Nutch Change LogNutch Current Development+* NUTCH-1700 Remove deprecated code from creativecommons plugin (lewismc)+* NUTCH-1761 Crawl script fails to find job file if not started from inside bin dir (David Hosking, jnioche)* NUTCH-1603 ZIP parser complains about truncated PDF file (snagel)diff --git a/src/plugin/creativecommons/build.xml b/src/plugin/creativecommons/build.xmlindex c141a8cee..6443d7f2a 100755--- a/src/plugin/creativecommons/build.xml+++ b/src/plugin/creativecommons/build.xml@@ -25,38 +25,4 @@<!-- <ant target="deploy" inheritall="false" dir="../parse-html"/> --></target>-- <property name="this.web" location="${root}/src/web"/>- <property name="nutch.web" location="${nutch.root}/src/web"/>-- <!-- Make creativecommons.war -->- <target name="war">- <war destfile="${build.dir}/${name}.war"- webxml="${this.web}/web.xml">- <fileset dir="${nutch.web}/jsp" excludes="**/search.jsp"/>- <fileset dir="${nutch.root}/docs">- <include name="img/*.gif"/>- </fileset>- <fileset dir="${this.web}" includes="search.jsp"/>- <classes dir="${nutch.root}/conf" excludes="**/*.template"/>- <classes dir="${root}/conf"/>- <classes dir="${nutch.web}/locale"/>- <zipfileset dir="${this.web}" includes="include/*.html"/>- <lib dir="${nutch.root}/lib">- <include name="lucene*.jar"/>- <include name="taglibs-*.jar"/>- <include name="dom4j-*.jar"/>- </lib>- <lib dir="${nutch.root}/build">- <include name="nutch-*.jar"/>- </lib>- <zipfileset prefix="WEB-INF/classes/plugins"- dir="${nutch.root}/build/plugins"/>- <webinf dir="${nutch.root}/lib">- <include name="taglibs-*.tld"/>- </webinf>- </war>- </target>--</project>diff --git a/src/plugin/creativecommons/src/web/include/footer.html b/src/plugin/creativecommons/src/web/include/footer.htmldeleted file mode 100755index ef4e0cc05..000000000--- a/src/plugin/creativecommons/src/web/include/footer.html+++ /dev/null@@ -1,17 +0,0 @@-<div id="footer"><img src="/images/footer.gif" alt="" width="760" /></div>-<div id="subfooter"><a href="http://creativecommons.org/">Creative Commons</a> | <a href="http://sourceforge.net/tracker/?group_id=80503&atid=559966">report bugs</a> | <a href="/url-add/">add a url</a></div>--<div id="subfooter">-<p align="center">-<a href="http://creativecommons.org/licenses/by/2.0/" rel="license">- <img src="http://creativecommons.org/images/public/somerights.gif"- width="88" height="31" alt="Creative Commons License" border="0"/>-</a>-<br/>-Except where otherwise noted, <br/>this site is licensed under a <a-href="http://creativecommons.org/licenses/by/2.0/">Creative Commons-License</a>.-<br/>-</p>-</div>-</div>diff --git a/src/plugin/creativecommons/src/web/include/header.html b/src/plugin/creativecommons/src/web/include/header.htmldeleted file mode 100755index e69de29bb..000000000diff --git a/src/plugin/creativecommons/src/web/include/style.html b/src/plugin/creativecommons/src/web/include/style.htmldeleted file mode 100755index 9775ad7e7..000000000--- a/src/plugin/creativecommons/src/web/include/style.html+++ /dev/null@@ -1,103 +0,0 @@-<style type="text/css">- body {- background:#eee;- font-family: "Trebuchet MS",verdana,sans-serif;- font-size: 12px;- color:#333;- }-- #container {- width: 760px;- margin: 0px;- margin-left: auto;- margin-right: auto;- padding: 0px;- }-- #banner {- padding: 0px;- margin-bottom: 0px;- background: #fff url(/images/background.gif) repeat-y 50% 0;- }-- #content {- padding: 20px;- margin-top:0px;- background: #fff url(/images/background.gif) repeat-y 50% 0;- }-- .searchbox {- margin-left:50px;- margin-right:50px;- margin-bottom:50px;- text-align:center;- }-- .resultsbox {- margin-left:50px;- margin-right:50px;- margin-bottom:50px;- text-align:left;- }-- h1 {- font-size:18px;- font-family:Georgia;- color:#666;- }-- h1 a {- text-decoration:none;- }-- #footer {- clear: both;- padding:0px;- margin-top:0px;- }-- #subfooter a {- color:#999;- }-- #subfooter {- margin-left:10px;- font-size:11px;- color:#999;- }-- .box {- width:450px;- }-- .searchhelp {- margin:50px 50px 10px 50px;- font-size:11px;- border:1px solid #ccc;- padding-left:20px;- padding-right:20px;- color:#666;- }-- .searchform {- margin-bottom:50px;- }-- .notes {- font-size:11px;- color:green;- }-- .searchtitle {- font-size:16px;- }-- .searchoptions {- margin-top:10px;- }-- a:link {color:#a00;}- a:visited {color:#815151;}- a:active {color:red;}- a:hover {color:red;text-decoration:underline;}-</style>diff --git a/src/plugin/creativecommons/src/web/search.jsp b/src/plugin/creativecommons/src/web/search.jspdeleted file mode 100755index e3c52b002..000000000--- a/src/plugin/creativecommons/src/web/search.jsp+++ /dev/null@@ -1,223 +0,0 @@-<%@ page- contentType="text/html; charset=UTF-8"- pageEncoding="UTF-8"-- import="javax.servlet.*"- import="javax.servlet.http.*"- import="java.io.*"- import="java.util.*"- import="java.net.*"-- import="org.apache.nutch.html.Entities"- import="org.apache.nutch.searcher.*"-%><%- NutchBean bean = NutchBean.get(application);- // set the character encoding to use when interpreting request values- request.setCharacterEncoding("UTF-8");-- bean.LOG.info("query request from " + request.getRemoteAddr());-- // get query from request- String queryString = request.getParameter("query");- if (queryString == null)- queryString = "";- String htmlQueryString = Entities.encode(queryString);-- int start = 0; // first hit to display- String startString = request.getParameter("start");- if (startString != null)- start = Integer.parseInt(startString);-- int hitsPerPage = 10; // number of hits to display- String hitsString = request.getParameter("hitsPerPage");- if (hitsString != null)- hitsPerPage = Integer.parseInt(hitsString);-- int hitsPerSite = 2; // max hits per site- String hitsPerSiteString = request.getParameter("hitsPerSite");- if (hitsPerSiteString != null)- hitsPerSite = Integer.parseInt(hitsPerSiteString);-- Query query = Query.parse(queryString);-- boolean commercial = false;- String commercialString = request.getParameter("commercial");- if (commercialString != null)- commercial = "true".equals(commercialString);- if (commercial)- query.addProhibitedTerm("nc", "cc");-- boolean derivatives = false;- String derivativesString = request.getParameter("derivatives");- if (derivativesString != null)- derivatives = "true".equals(derivativesString);- if (derivatives)- query.addProhibitedTerm("nd", "cc");-- String format = request.getParameter("format");- if (format == null)- format = "";- if (!"".equals(format))- query.addRequiredTerm(format, "cc");-- bean.LOG.info("query: " + query);-- String language =- ResourceBundle.getBundle("org.nutch.jsp.search", request.getLocale())- .getLocale().getLanguage();-- String requestURI = HttpUtils.getRequestURL(request).toString();- String base = requestURI.substring(0, requestURI.lastIndexOf('/'));-%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">-<%- // To prevent the character encoding declared with 'contentType' page- // directive from being overriden by JSTL (apache i18n), we freeze it- // by flushing the output buffer.- // see http://java.sun.com/developer/technicalArticles/Intl/MultilingualJSP/- out.flush();-%>-<%@ taglib uri="http://jakarta.apache.org/taglibs/i18n" prefix="i18n" %>-<i18n:bundle baseName="org.nutch.jsp.search"/>-<html lang="<%= language %>">-<meta http-equiv="Content-Type" content="text/html; charset=utf-8">-<head>-<title>Creative Commons: <i18n:message key="title"/></title>-<link rel="icon" href="http://creativecommons.org/includes/cc.ico" type="image/ico" />-<link rel="SHORTCUT ICON" href="http://creativecommons.org/includes/cc.ico" />-<jsp:include page="/include/style.html"/>-<base href="<%= base + "/" + language %>/">-</head>--<body>--<jsp:include page="/include/header.html"/>--<div class="searchbox">-<h1><a href="http://creativecommons.org/">Creative Commons</a> RDF-enhanced search</h1>--<form action="/search.jsp" class="searchform" name="search" method="get">--<input type="text" name="query" value="<%=htmlQueryString%>" class="box"/><br/>-<input type="submit" value="<i18n:message key="search"/>">-<span class="notes">[<a href="help" onclick="window.open('help', 'help', 'width=500,height=300,scrollbars=yes,resizable=yes,toolbar=no,directories=no,location=no,menubar=no,status=yes');return false;">Help</a>]</span><br />--<div class="searchoptions">-<input type="checkbox" name="commercial" value=true- <%=commercial?"checked":""%> /> I want to make commercial use.-<br/>--<input type="checkbox" name="derivatives" value=true- <%=derivatives?"checked":""%> /> I want to create derivative works.-<br/>--Format: <select name="format">-<option <%="".equals(format)?"selected":""%> value="">Any</option>-<option <%="audio".equals(format)?"selected":""%> value="audio">Audio</option>-<option <%="image".equals(format)?"selected":""%> value="image">Image</option>-<option <%="interactive".equals(format)?"selected":""%> value="interactive">Interactive</option>-<option <%="text".equals(format)?"selected":""%> value="text">Text</option>-<option <%="video".equals(format)?"selected":""%> value="video" >Video</option>-</select>-</div>-<input type="hidden" name="hitsPerPage" value="<%=hitsPerPage%>">-<input type="hidden" name="hitsPerSite" value="<%=hitsPerSite%>">-</form>-</div>--<div class="resultsbox">--<%- // perform query- Hits hits = bean.search(query, start + hitsPerPage, hitsPerSite);- int end = (int)Math.min(hits.getLength(), start + hitsPerPage);- int length = end-start;- Hit[] show = hits.getHits(start, length);- HitDetails[] details = bean.getDetails(show);- String[] summaries = bean.getSummary(details, query);-- bean.LOG.info("total hits: " + hits.getTotal());-%>--<i18n:message key="hits">- <i18n:messageArg value="<%=new Long(start+1)%>"/>- <i18n:messageArg value="<%=new Long(end)%>"/>- <i18n:messageArg value="<%=new Long(hits.getTotal())%>"/>-</i18n:message>--<%- for (int i = 0; i < length; i++) { // display the hits- Hit hit = show[i];- HitDetails detail = details[i];- String title = detail.getValue("title");- String url = detail.getValue("url");- String summary = summaries[i];- String id = "idx=" + hit.getIndexNo() + "&id=" + hit.getIndexDocNo();-- if (title == null || title.equals("")) // use url for docs w/o title- title = url;- %>- <br><br><b>- <a href="<%=url%>"><%=Entities.encode(title)%></a>- </b>- <% if (!"".equals(summary)) { %>- <br><%=summary%>- <% } %>- <br>- <span class="url"><%=Entities.encode(url)%></span>- (<a href="/cached.jsp?<%=id%>"><i18n:message key="cached"/></a>)- (<a href="/explain.jsp?<%=id%>&query=<%=URLEncoder.encode(queryString)%>"><i18n:message key="explain"/></a>)-<!--- (<a href="/anchors.jsp?<%=id%>"><i18n:message key="anchors"/></a>)--->- <% if (hit.moreFromSiteExcluded()) {- String more =- "query="+URLEncoder.encode("site:"+hit.getSite()+" "+queryString)- +"&start="+start+"&hitsPerPage="+hitsPerPage+"&hitsPerSite="+0;%>- (<a href="/search.jsp?<%=more%>"><i18n:message key="moreFrom"/>- <%=hit.getSite()%></a>)- <% } %>-<% } %>--<%-if ((hits.totalIsExact() && end < hits.getTotal()) // more hits to show- || (!hits.totalIsExact() && (hits.getLength() >= start+hitsPerPage))) {-%>- <form name="search" action="/search.jsp" method="get">- <input type="hidden" name="query" value="<%=htmlQueryString%>">- <input type="hidden" name="start" value="<%=end%>">- <input type="hidden" name="hitsPerPage" value="<%=hitsPerPage%>">- <input type="hidden" name="hitsPerSite" value="<%=hitsPerSite%>">- <input type="hidden" name="commercial" value="<%=commercial%>">- <input type="hidden" name="derivatives" value="<%=derivatives%>">- <input type="hidden" name="format" value="<%=format%>">- <input type="submit" value="<i18n:message key="next"/>">- </form>-<%- }--if ((!hits.totalIsExact() && (hits.getLength() < start+hitsPerPage))) {-%>- <form name="search" action="/search.jsp" method="get">- <input type="hidden" name="query" value="<%=htmlQueryString%>">- <input type="hidden" name="hitsPerPage" value="<%=hitsPerPage%>">- <input type="hidden" name="hitsPerSite" value="0">- <input type="hidden" name="commercial" value="<%=commercial%>">- <input type="hidden" name="derivatives" value="<%=derivatives%>">- <input type="hidden" name="format" value="<%=format%>">- <input type="submit" value="<i18n:message key="showAllHits"/>">- </form>-<%- }-%>--</div>--<br>-<a href="http://www.nutch.org/">-<img border="0" src="/img/poweredbynutch_01.gif">-</a>--<jsp:include page="/include/footer.html"/>--</body>-</html>diff --git a/src/plugin/creativecommons/src/web/web.xml b/src/plugin/creativecommons/src/web/web.xmldeleted file mode 100755index 96fecf147..000000000--- a/src/plugin/creativecommons/src/web/web.xml+++ /dev/null@@ -1,34 +0,0 @@-<?xml version="1.0" encoding="ISO-8859-1"?>-<!--- Licensed to the Apache Software Foundation (ASF) under one or more- contributor license agreements. See the NOTICE file distributed with- this work for additional information regarding copyright ownership.- The ASF licenses this file to You under the Apache License, Version 2.0- (the "License"); you may not use this file except in compliance with- the License. You may obtain a copy of the License at-- http://www.apache.org/licenses/LICENSE-2.0-- Unless required by applicable law or agreed to in writing, software- distributed under the License is distributed on an "AS IS" BASIS,- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- See the License for the specific language governing permissions and- limitations under the License.--->--<!DOCTYPE web-app- PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"- "http://java.sun.com/dtd/web-app_2_3.dtd">--<web-app>--<welcome-file-list>- <welcome-file>search.jsp</welcome-file>-</welcome-file-list>--<taglib>- <taglib-uri>http://jakarta.apache.org/taglibs/i18n</taglib-uri>- <taglib-location>/WEB-INF/taglibs-i18n.tld</taglib-location>- </taglib>--</web-app>