From 4eb89d7f152c6b54028b21205c2bf99a6eeb302f Mon Sep 17 00:00:00 2001 From: reger Date: Mon, 5 Jan 2015 09:10:20 +0100 Subject: [PATCH] revert clickservlet (default was indeed a mistakenly) --- defaults/web.xml | 16 -- defaults/yacy.init | 1 - htroot/ConfigPortal.html | 7 - htroot/ConfigPortal.java | 4 - htroot/yacysearchitem.java | 2 - .../net/yacy/http/servlets/ClickServlet.java | 146 ------------------ .../net/yacy/search/SwitchboardConstants.java | 2 - 7 files changed, 178 deletions(-) delete mode 100644 source/net/yacy/http/servlets/ClickServlet.java diff --git a/defaults/web.xml b/defaults/web.xml index 91d8323da..41cdbfb42 100644 --- a/defaults/web.xml +++ b/defaults/web.xml @@ -55,23 +55,7 @@ YaCy stop proxy - - ClickServlet - net.yacy.http.servlets.ClickServlet - - clickaction - index - defines the action to perform with supplied url - - - - - - - ClickServlet - /click - SolrSelectServlet diff --git a/defaults/yacy.init b/defaults/yacy.init index a85ee24e8..ac1ae07a6 100644 --- a/defaults/yacy.init +++ b/defaults/yacy.init @@ -826,7 +826,6 @@ search.result.show.proxy = false search.result.show.hostbrowser = true search.result.show.vocabulary = false -search.result.useclickservlet = false # search navigators: comma-separated list of default values for search navigation. # can be temporary different if search string is given with differen navigation values diff --git a/htroot/ConfigPortal.html b/htroot/ConfigPortal.html index b2f7bcd0a..6e5dda7d1 100644 --- a/htroot/ConfigPortal.html +++ b/htroot/ConfigPortal.html @@ -69,13 +69,6 @@ add remote search results to the local index ( default=on, it is recommended to enable this option ! ) - #(remotesearch.result.store)# -
Use Click-Servlet for search result links
-
- allows YaCy to perform some actions if user clicks on a search result (by default add the clicked link to the index) -
- ::#(/remotesearch.result.store)# -
Default Pop-Up Page
Status Page  diff --git a/htroot/ConfigPortal.java b/htroot/ConfigPortal.java index 2c618c730..3aa5627b3 100644 --- a/htroot/ConfigPortal.java +++ b/htroot/ConfigPortal.java @@ -93,8 +93,6 @@ public class ConfigPortal { final boolean storeresult = post.getBoolean(SwitchboardConstants.REMOTESEARCH_RESULT_STORE); sb.setConfig(SwitchboardConstants.REMOTESEARCH_RESULT_STORE, storeresult); - // click servlet only meaningful if result not stored (currently) - sb.setConfig(SwitchboardConstants.SEARCH_USECLICKSERVLET, !storeresult && post.getBoolean(SwitchboardConstants.SEARCH_USECLICKSERVLET)); sb.setConfig(SwitchboardConstants.SEARCH_VERIFY, post.get("search.verify", "ifexist")); sb.setConfig(SwitchboardConstants.SEARCH_VERIFY_DELETE, post.getBoolean("search.verify.delete")); @@ -150,7 +148,6 @@ public class ConfigPortal { sb.setConfig("search.options", config.getProperty("search.options","true")); sb.setConfig(SwitchboardConstants.GREEDYLEARNING_ACTIVE, config.getProperty(SwitchboardConstants.GREEDYLEARNING_ACTIVE)); sb.setConfig(SwitchboardConstants.REMOTESEARCH_RESULT_STORE, config.getProperty(SwitchboardConstants.REMOTESEARCH_RESULT_STORE)); - sb.setConfig(SwitchboardConstants.REMOTESEARCH_RESULT_STORE+"_"+SwitchboardConstants.SEARCH_USECLICKSERVLET, config.getProperty(SwitchboardConstants.SEARCH_USECLICKSERVLET)); sb.setConfig(SwitchboardConstants.SEARCH_VERIFY, config.getProperty(SwitchboardConstants.SEARCH_VERIFY,"iffresh")); sb.setConfig(SwitchboardConstants.SEARCH_VERIFY_DELETE, config.getProperty(SwitchboardConstants.SEARCH_VERIFY_DELETE,"true")); sb.setConfig("about.headline", config.getProperty("about.headline","")); @@ -173,7 +170,6 @@ public class ConfigPortal { prop.put(SwitchboardConstants.GREEDYLEARNING_LIMIT_DOCCOUNT, sb.getConfig(SwitchboardConstants.GREEDYLEARNING_LIMIT_DOCCOUNT, "0")); prop.put(SwitchboardConstants.REMOTESEARCH_RESULT_STORE, sb.getConfigBool(SwitchboardConstants.REMOTESEARCH_RESULT_STORE, true) ? 1 : 0); - prop.put(SwitchboardConstants.REMOTESEARCH_RESULT_STORE+"_"+SwitchboardConstants.SEARCH_USECLICKSERVLET, sb.getConfigBool(SwitchboardConstants.SEARCH_USECLICKSERVLET, false) ? 1 : 0); prop.put("search.navigation.hosts", sb.getConfig("search.navigation", "").indexOf("hosts",0) >= 0 ? 1 : 0); prop.put("search.navigation.authors", sb.getConfig("search.navigation", "").indexOf("authors",0) >= 0 ? 1 : 0); diff --git a/htroot/yacysearchitem.java b/htroot/yacysearchitem.java index 9fd2c2efb..552801aac 100644 --- a/htroot/yacysearchitem.java +++ b/htroot/yacysearchitem.java @@ -181,8 +181,6 @@ public class yacysearchitem { } } prop.putXML("content_link", modifyURL); // putXML for rss - } else if (sb.getConfigBool(SwitchboardConstants.SEARCH_USECLICKSERVLET, false)) { - prop.putXML("content_link", "click?url="+resultUrlstring); // putXML for rss } else { prop.putXML("content_link", resultUrlstring); // putXML for rss } diff --git a/source/net/yacy/http/servlets/ClickServlet.java b/source/net/yacy/http/servlets/ClickServlet.java deleted file mode 100644 index 1599c8437..000000000 --- a/source/net/yacy/http/servlets/ClickServlet.java +++ /dev/null @@ -1,146 +0,0 @@ -/** - * ClickServlet - * Copyright 2014 by reger - * First released 04.01.2015 at http://yacy.net - * - * This library is free software; you can redistribute it and/or modify it under - * the terms of the GNU Lesser General Public License as published by the Free - * Software Foundation; either version 2.1 of the License, or (at your option) - * any later version. - * - * This library is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more - * details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program in the file lgpl21.txt If not, see - * . - */ - -package net.yacy.http.servlets; - -import java.io.IOException; -import java.io.PrintWriter; -import java.util.ArrayList; -import java.util.Collection; - -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import net.yacy.cora.document.id.DigestURL; -import net.yacy.cora.util.ConcurrentLog; -import net.yacy.search.Switchboard; -import net.yacy.search.SwitchboardConstants; - -/** - * The ClickServlet is used as search result link to perform additional actions - * upon click on the link by user. The actual target url is given as parameter, - * the servlet forwards the user to the target link page and performs additonal - * actions with the target url (basically alternative of using javascript - * href.onClick() ) - * - * Request Parameter: url= the target User browser is forwarded to the url using - * html header or javascript afterwards performs configured actions, - * - * Actions e.g. (0- = not implemented yet) - * - crawl/recrawl the url - * - crawl all links on page (with depth) / site - * 0- increase/create rating - * 0- add to a collection - * 0- connect query and url - * 0- learn and classify content - promote rating - * 0- add to click statistic url/cnt (maybe to use for boost) - */ -public class ClickServlet extends HttpServlet { - - private static final long serialVersionUID = 1L; - - // config switches to remember actions to perform - String _actionCode = "index"; - - static final String crawlaction = "crawl"; // actionCode to add url to crawler with crawldepth=0 - static final String indexaction = "index"; // actionCode to add url to index (=default) - static final String crawllinksaction = "crawllinks"; // actionCode to add url to crawler with crawldepth=1 - - @Override - public void init() { - if (this.getInitParameter("clickaction") != null) { - _actionCode = this.getInitParameter("clickaction"); - } - } - - @Override - public void service(ServletRequest request, ServletResponse response) throws IOException, ServletException { - - HttpServletRequest hrequest = (HttpServletRequest) request; - HttpServletResponse hresponse = (HttpServletResponse) response; - - final String strUrl = hrequest.getParameter("url"); - if (strUrl == null) { - hresponse.sendError(HttpServletResponse.SC_NOT_FOUND, "url parameter missing"); - return; - } - - try { - hresponse.setStatus(HttpServletResponse.SC_OK); - /* alternative to use javascript / http-equiv header - hresponse.setStatus(HttpServletResponse.SC_TEMPORARY_REDIRECT); - hresponse.setHeader(HeaderFramework.LOCATION, strUrl); - */ - - // output html forward to url header - PrintWriter pw = response.getWriter(); - response.setContentType("text/html"); - - pw.println(""); - pw.println(""); - - pw.print(""); - - pw.print(""); - - pw.println(""); - pw.close(); - - if (Switchboard.getSwitchboard().getConfigBool(SwitchboardConstants.SEARCH_USECLICKSERVLET, false)) { - - // do click event action - if (_actionCode != null) { - switch (_actionCode) { - case crawlaction: { - final Collection urls = new ArrayList(); - urls.add(new DigestURL(strUrl)); - Switchboard.getSwitchboard().addToCrawler(urls, false); - break; - } - case indexaction: { - final Collection urls = new ArrayList(); - urls.add(new DigestURL(strUrl)); - - Switchboard.getSwitchboard().addToIndex(urls, null, null, null, true); - break; - } - case crawllinksaction: { - final Collection urls = new ArrayList(); - urls.add(new DigestURL(strUrl)); - Switchboard.getSwitchboard().addToCrawler(urls, false); - Switchboard.getSwitchboard().heuristicSearchResults(strUrl); - break; - } - } - } - } - } catch (Exception e) { - ConcurrentLog.logException(e); - } - } - -} diff --git a/source/net/yacy/search/SwitchboardConstants.java b/source/net/yacy/search/SwitchboardConstants.java index 26b476aa1..df2c66e4c 100644 --- a/source/net/yacy/search/SwitchboardConstants.java +++ b/source/net/yacy/search/SwitchboardConstants.java @@ -526,8 +526,6 @@ public final class SwitchboardConstants { public static final String SEARCH_VERIFY = "search.verify"; public static final String SEARCH_VERIFY_DELETE = "search.verify.delete"; - public static final String SEARCH_USECLICKSERVLET = "search.result.useclickservlet"; // resultlink via click servlet - /** * ranking+evaluation */