Author: ssmiweve Date: 2008-10-25 21:11:23 +0200 (Sat, 25 Oct 2008) New Revision: 6892
Added: trunk/generic.sesam/velocity-directives/src/main/java/no/sesat/search/view/velocity/FaviconDirective.java Modified: trunk/ trunk/core-api/src/main/java/no/sesat/search/run/RunningQueryImpl.java trunk/generic.sesam/search-command-control/default/src/main/java/no/sesat/search/mode/command/OverturePPCSearchCommand.java trunk/generic.sesam/sesam.com/war/src/main/webapp/WEB-INF/classes/fragments/layout/sesam.com/footer.jsp trunk/generic.sesam/war/src/main/conf/configuration.properties trunk/generic.sesam/war/src/main/templates/pages/403.vm trunk/generic.sesam/war/src/main/templates/pages/404.vm trunk/generic.sesam/war/src/main/templates/pages/500.vm trunk/generic.sesam/war/src/main/templates/pages/501.vm trunk/generic.sesam/war/src/main/templates/pages/503.vm trunk/war/src/main/java/no/sesat/search/http/servlet/BoomerangServlet.java trunk/war/src/main/webapp/WEB-INF/jsp/500.jsp Log: Merged revisions 6829,6856,6859,6862-6864,6867,6870 via svnmerge from http://sesat.no/svn/sesat-kernel/branches/2.17 ........ r6829 | ssmiweve | 2008-09-19 10:38:30 +0200 (Fri, 19 Sep 2008) | 1 line Issue SKER4739: (Exception when accessing a non-existing skin) ........ r6856 | ssmiweve | 2008-09-30 13:06:15 +0200 (Tue, 30 Sep 2008) | 5 lines OPS-368 - Lots of downtime measured in September OPS-344 - Store problemer med 404'er p?\195?\165 omskrevne URL:er OPS-335 - Too many pingdom alerts to vakt phone to be taken seriously Issue SKER4711: (S?\195?\184k p?\195?\165 lange s?\195?\184kestrenger tar lang tid i eksekvere) ........ r6859 | ssmiweve | 2008-10-01 12:48:26 +0200 (Wed, 01 Oct 2008) | 1 line sesam.com ........ r6862 | sshafroi | 2008-10-06 11:45:03 +0200 (Mon, 06 Oct 2008) | 5 lines SEARCH-4890 - Favicon fungerer ikke i Opera Added FaviconVelocity macro, that will resolve the path to the favicon. ........ r6863 | sshafroi | 2008-10-06 14:30:47 +0200 (Mon, 06 Oct 2008) | 3 lines Use rel="shortcut icon" as default, not just "icon". The rel attribute is space-delimited, so shortcut is just added to the list. This seams to be the standard way of doing it. ........ r6864 | sshafroi | 2008-10-06 14:59:37 +0200 (Mon, 06 Oct 2008) | 5 lines SEARCH-4890 - Favicon fungerer ikke i Opera Make use of new #favicon(.. vm directive ........ r6867 | ssmiweve | 2008-10-09 12:08:24 +0200 (Thu, 09 Oct 2008) | 2 lines Issue SKER5012: (IP info missing in hunting boomerang logging for Sesam.se skins) ........ r6870 | sshafroi | 2008-10-09 14:10:49 +0200 (Thu, 09 Oct 2008) | 5 lines SEARCH-5075 - Rette feil i overture parameter Fixed by Thomas K ........ Property changes on: trunk ___________________________________________________________________ Name: svnmerge-integrated - /branches/2.10:1-4690,4692-4745 /branches/2.11:1-4933 /branches/2.12:1-5051,5053-5106 /branches/2.13:1-5378 /branches/2.14:1-5508 /branches/2.15:1-5995 /branches/2.16:1-6499 /branches/2.17:1-6713,6715-6826 /branches/2.6:1-3877 /branches/2.7:1-4160 /branches/2.8:1-4446 /branches/2.9:1-4626 /branches/MAP_SEARCHv2:1-4544 + /branches/2.10:1-4690,4692-4745 /branches/2.11:1-4933 /branches/2.12:1-5051,5053-5106 /branches/2.13:1-5378 /branches/2.14:1-5508 /branches/2.15:1-5995 /branches/2.16:1-6499 /branches/2.17:1-6713,6715-6891 /branches/2.6:1-3877 /branches/2.7:1-4160 /branches/2.8:1-4446 /branches/2.9:1-4626 /branches/MAP_SEARCHv2:1-4544 Modified: trunk/core-api/src/main/java/no/sesat/search/run/RunningQueryImpl.java =================================================================== --- trunk/core-api/src/main/java/no/sesat/search/run/RunningQueryImpl.java 2008-10-24 21:28:52 UTC (rev 6891) +++ trunk/core-api/src/main/java/no/sesat/search/run/RunningQueryImpl.java 2008-10-25 19:11:23 UTC (rev 6892) @@ -146,7 +146,7 @@ LOG.trace("RunningQuery(cxt," + query + ')'); - final String queryStr = trimDuplicateSpaces(query); + final String queryStr = truncate(trimDuplicateSpaces(query)); final SiteContext siteCxt = new SiteContext(){ public Site getSite() { @@ -438,6 +438,18 @@ // Private ------------------------------------------------------- + /** Truncates string to an acceptable length. **/ + private String truncate(final String query){ + + // generic.sesam defines a default value of 256 + final int length = Integer.parseInt( + context.getDataModel().getSite().getSiteConfiguration().getProperty("sesat.query.characterLimit")); + + return length < query.length() + ? query.substring(0, length) + : query; + } + private boolean useEnrichment( final EnrichmentHint eHint, final SearchConfiguration config, Modified: trunk/generic.sesam/search-command-control/default/src/main/java/no/sesat/search/mode/command/OverturePPCSearchCommand.java =================================================================== --- trunk/generic.sesam/search-command-control/default/src/main/java/no/sesat/search/mode/command/OverturePPCSearchCommand.java 2008-10-24 21:28:52 UTC (rev 6891) +++ trunk/generic.sesam/search-command-control/default/src/main/java/no/sesat/search/mode/command/OverturePPCSearchCommand.java 2008-10-25 19:11:23 UTC (rev 6892) @@ -50,7 +50,7 @@ private static final String OVERTURE_PPC_ELEMENT = "Listing"; // Old school sitesearches - private static final String SITE_SEARCH_OVERTURE_PARTNER_ID = "schibstedsok_xml_no_searchbox_impl2"; + private static final String SITE_SEARCH_OVERTURE_PARTNER_ID = "schibstedsok_xml_no_searchbox_imp2"; private static final Logger LOG = Logger.getLogger(OverturePPCSearchCommand.class); Modified: trunk/generic.sesam/sesam.com/war/src/main/webapp/WEB-INF/classes/fragments/layout/sesam.com/footer.jsp =================================================================== --- trunk/generic.sesam/sesam.com/war/src/main/webapp/WEB-INF/classes/fragments/layout/sesam.com/footer.jsp 2008-10-24 21:28:52 UTC (rev 6891) +++ trunk/generic.sesam/sesam.com/war/src/main/webapp/WEB-INF/classes/fragments/layout/sesam.com/footer.jsp 2008-10-25 19:11:23 UTC (rev 6892) @@ -28,4 +28,22 @@ <div id="builtWithSesat"><search:text key="builtWithSesat"/></div> <div id="resultsFromYahoo"><search:text key="resultsFromYahoo"/></div> </div> -</jsp:root> \ No newline at end of file + +<!-- This is to collect statistics against http://sesam.com --> +<jsp:text><![CDATA[ + <script type='text/javascript' src='/javascript/tmv11.js'></script> + <script type="text/javascript"> + <!-- + var tmsec = new Array(3); + tmsec[0]="tmsec=sesam"; + tmsec[1]="tmsec=sesamsok"; + tmsec[2]="tmsec=sesamsok"; + getTMqs('','', 'sesam_no', 'no', 'iso-8859-15', tmsec); + //--> + </script> + <noscript><div> + <img src="http://statistik-gallup.net/V11***sesam_no/no/iso-8859-15/tmsec=sesam&tmsec=sesamsok&tmsec=sesamsok" alt="" /> + </div></noscript> +]]></jsp:text> + +</jsp:root> Property changes on: trunk/generic.sesam/sesam.com/war/src/main/webapp/WEB-INF/classes/fragments/layout/sesam.com/footer.jsp ___________________________________________________________________ Name: svn:keywords + Id Copied: trunk/generic.sesam/velocity-directives/src/main/java/no/sesat/search/view/velocity/FaviconDirective.java (from rev 6870, branches/2.17/generic.sesam/velocity-directives/src/main/java/no/sesat/search/view/velocity/FaviconDirective.java) =================================================================== --- trunk/generic.sesam/velocity-directives/src/main/java/no/sesat/search/view/velocity/FaviconDirective.java (rev 0) +++ trunk/generic.sesam/velocity-directives/src/main/java/no/sesat/search/view/velocity/FaviconDirective.java 2008-10-25 19:11:23 UTC (rev 6892) @@ -0,0 +1,90 @@ +/* Copyright (2008) Schibsted Søk AS + * This file is part of SESAT. + * + * SESAT is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * SESAT 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with SESAT. If not, see <http://www.gnu.org/licenses/>. + */ +package no.sesat.search.view.velocity; + +import java.io.IOException; + +import java.io.Writer; +import no.sesat.search.view.FindResource; + +import org.apache.log4j.Logger; +import org.apache.velocity.context.InternalContextAdapter; +import org.apache.velocity.exception.MethodInvocationException; +import org.apache.velocity.exception.ParseErrorException; +import org.apache.velocity.exception.ResourceNotFoundException; +import org.apache.velocity.runtime.parser.node.Node; + +/** + * This directive creates a link element used to specify the favicon element. + * The #favicon directive should be placed inside the head element of the page. + * The resolved resource name is used since some browsers (Opera) will not show the + * favicon when it is a redirect. + * + * Example: + * #favicon("/images/favicon.gif") + * <link href="/genericno.localhost//images/1223283733372/favicon.gif" rel="shortcut icon" type="image/gif" /> + * + * #favicon("/images/favicon.png" 'type="image/png" rel="icon"') + * <link href="/genericno.localhost//images/1223284107022/favicon.gif" type="image/png" rel="icon"/> + * + */ +public final class FaviconDirective extends AbstractDirective { + + private static final Logger LOG = Logger.getLogger(FaviconDirective.class); + + private static final String NAME = "favicon"; + + /** + * [EMAIL PROTECTED] + */ + public int getType() { + return LINE; + } + + public String getName() { + return NAME; + } + + /** + * [EMAIL PROTECTED] + */ + public boolean render( + final InternalContextAdapter context, + final Writer writer, + final Node node) + throws IOException, ResourceNotFoundException, ParseErrorException, MethodInvocationException { + + final int argCount = node.jjtGetNumChildren(); + final String resolvedPath = FindResource.find(getDataModel(context).getSite().getSite(), getArgument(context, node, 0)); + + if (argCount == 1) { + writer.write("<link href=\"" + resolvedPath + "\" rel=\"shortcut icon\" type=\"image/gif\" />"); + } + if (argCount == 2) { + writer.write("<link href=\"" + resolvedPath + "\" " + getArgument(context, node, 1) + "/>"); + } + else{ + final String msg = '#' + getName() + " - wrong number of arguments"; + LOG.error(msg); + rsvc.getLog().error(msg); + return false; + } + + return true; + + } +} Modified: trunk/generic.sesam/war/src/main/conf/configuration.properties =================================================================== --- trunk/generic.sesam/war/src/main/conf/configuration.properties 2008-10-24 21:28:52 UTC (rev 6891) +++ trunk/generic.sesam/war/src/main/conf/configuration.properties 2008-10-25 19:11:23 UTC (rev 6892) @@ -1,6 +1,9 @@ # Default Locale. Shouldn't ever be used at this level. site.locale.default=no +# Default character limit on query string +sesat.query.characterLimit=256 + # Default mail host [EMAIL PROTECTED]@ @@ -8,7 +11,7 @@ sesam.datamodel.impl=no.sesat.search.datamodel.DataModelFactoryImpl # Velocity Directives -velocity.directives.0=no.sesat.search.view.velocity.UrlEncodeDirective,no.sesat.search.view.velocity.HtmlEscapeDirective,no.sesat.search.view.velocity.CapitalizeWordsDirective,no.sesat.search.view.velocity.ChopStringDirective,no.sesat.search.view.velocity.PublishDirective,no.sesat.search.view.velocity.XmlEscapeDirective,no.sesat.search.view.velocity.MailEncodeDirective,no.sesat.search.view.velocity.WikiDirective,no.sesat.search.view.velocity.UpperCaseDirective,no.sesat.search.view.velocity.WeekdayDirective,no.sesat.search.view.velocity.MD5ParameterDirective,no.sesat.search.view.velocity.TopDomainDirective,no.sesat.search.view.velocity.DateFormattingDirective,no.sesat.search.view.velocity.BoldWordDirective,no.sesat.search.view.velocity.RemovePrefixDirective,no.sesat.search.view.velocity.SlashTrimStringDirective,no.sesat.search.view.velocity.XPathDirective,no.sesat.search.view.velocity.XPathForeachDirective,no.sesat.search.view.velocity.HitCountDirective,no.sesat.search.view.velocity.CssDirective,no.sesat.search.view.velocity.JavaScriptDirective,no.sesat.search.view.velocity.ImageDirective,no.sesat.search.view.velocity.AllParametersDirective +velocity.directives.0=no.sesat.search.view.velocity.UrlEncodeDirective,no.sesat.search.view.velocity.HtmlEscapeDirective,no.sesat.search.view.velocity.CapitalizeWordsDirective,no.sesat.search.view.velocity.ChopStringDirective,no.sesat.search.view.velocity.PublishDirective,no.sesat.search.view.velocity.XmlEscapeDirective,no.sesat.search.view.velocity.MailEncodeDirective,no.sesat.search.view.velocity.WikiDirective,no.sesat.search.view.velocity.UpperCaseDirective,no.sesat.search.view.velocity.WeekdayDirective,no.sesat.search.view.velocity.MD5ParameterDirective,no.sesat.search.view.velocity.TopDomainDirective,no.sesat.search.view.velocity.DateFormattingDirective,no.sesat.search.view.velocity.BoldWordDirective,no.sesat.search.view.velocity.RemovePrefixDirective,no.sesat.search.view.velocity.SlashTrimStringDirective,no.sesat.search.view.velocity.XPathDirective,no.sesat.search.view.velocity.XPathForeachDirective,no.sesat.search.view.velocity.HitCountDirective,no.sesat.search.view.velocity.CssDirective,no.sesat.search.view.velocity.JavaScriptDirective,no.sesat.search.view.velocity.FaviconDirective,no.sesat.search.view.velocity.ImageDirective,no.sesat.search.view.velocity.AllParametersDirective [EMAIL PROTECTED]@ Modified: trunk/generic.sesam/war/src/main/templates/pages/403.vm =================================================================== --- trunk/generic.sesam/war/src/main/templates/pages/403.vm 2008-10-24 21:28:52 UTC (rev 6891) +++ trunk/generic.sesam/war/src/main/templates/pages/403.vm 2008-10-25 19:11:23 UTC (rev 6892) @@ -4,12 +4,11 @@ <head> <title>403 - Forbidden</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> - <link rel="icon" href="/images/favicon.gif" type="image/x-icon" /> - <link rel="shortcut icon" href="/images/favicon.gif" type="image/x-icon" /> + #favicon("/images/favicon.gif") </head> <body style="margin:0; padding:0;" text="#ffffff" bgcolor="#000000"> <div style="padding-left:30px; font-size:12px; font-family: arial, sans-serif;"> The requested URL was forbidden. </div> </body> -</html> \ No newline at end of file +</html> Modified: trunk/generic.sesam/war/src/main/templates/pages/404.vm =================================================================== --- trunk/generic.sesam/war/src/main/templates/pages/404.vm 2008-10-24 21:28:52 UTC (rev 6891) +++ trunk/generic.sesam/war/src/main/templates/pages/404.vm 2008-10-25 19:11:23 UTC (rev 6892) @@ -4,12 +4,11 @@ <head> <title>404 - Not found</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> - <link rel="icon" href="/images/favicon.gif" type="image/x-icon" /> - <link rel="shortcut icon" href="/images/favicon.gif" type="image/x-icon" /> + #favicon("/images/favicon.gif") </head> <body style="margin:0; padding:0;"> <div style="padding-left:30px; font-size:12px; font-family: arial, sans-serif;"> The requested URL was not found on this server. </div> </body> -</html> \ No newline at end of file +</html> Modified: trunk/generic.sesam/war/src/main/templates/pages/500.vm =================================================================== --- trunk/generic.sesam/war/src/main/templates/pages/500.vm 2008-10-24 21:28:52 UTC (rev 6891) +++ trunk/generic.sesam/war/src/main/templates/pages/500.vm 2008-10-25 19:11:23 UTC (rev 6892) @@ -4,12 +4,11 @@ <head> <title>500 - Internal error</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> - <link rel="icon" href="/images/favicon.gif" type="image/x-icon" /> - <link rel="shortcut icon" href="/images/favicon.gif" type="image/x-icon" /> + #favicon("/images/favicon.gif") </head> <body style="margin:0; padding:0;"> <div style="padding-left:30px; font-size:12px; font-family: arial, sans-serif;"> Internal error </div> </body> -</html> \ No newline at end of file +</html> Modified: trunk/generic.sesam/war/src/main/templates/pages/501.vm =================================================================== --- trunk/generic.sesam/war/src/main/templates/pages/501.vm 2008-10-24 21:28:52 UTC (rev 6891) +++ trunk/generic.sesam/war/src/main/templates/pages/501.vm 2008-10-25 19:11:23 UTC (rev 6892) @@ -4,12 +4,11 @@ <head> <title>501 - Internal error</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> - <link rel="icon" href="/images/favicon.gif" type="image/x-icon" /> - <link rel="shortcut icon" href="/images/favicon.gif" type="image/x-icon" /> + #favicon("/images/favicon.gif") </head> <body style="margin:0; padding:0;"> <div style="padding-left:30px; font-size:12px; font-family: arial, sans-serif;"> Internal error </div> </body> -</html> \ No newline at end of file +</html> Modified: trunk/generic.sesam/war/src/main/templates/pages/503.vm =================================================================== --- trunk/generic.sesam/war/src/main/templates/pages/503.vm 2008-10-24 21:28:52 UTC (rev 6891) +++ trunk/generic.sesam/war/src/main/templates/pages/503.vm 2008-10-25 19:11:23 UTC (rev 6892) @@ -4,12 +4,11 @@ <head> <title>503 - Internal error</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> - <link rel="icon" href="/images/favicon.gif" type="image/x-icon" /> - <link rel="shortcut icon" href="/images/favicon.gif" type="image/x-icon" /> + #favicon("/images/favicon.gif") </head> <body style="margin:0; padding:0;"> <div style="padding-left:30px; font-size:12px; font-family: arial, sans-serif;"> Internal error </div> </body> -</html> \ No newline at end of file +</html> Modified: trunk/war/src/main/java/no/sesat/search/http/servlet/BoomerangServlet.java =================================================================== --- trunk/war/src/main/java/no/sesat/search/http/servlet/BoomerangServlet.java 2008-10-24 21:28:52 UTC (rev 6891) +++ trunk/war/src/main/java/no/sesat/search/http/servlet/BoomerangServlet.java 2008-10-25 19:11:23 UTC (rev 6892) @@ -75,6 +75,17 @@ res.setHeader("Pragma", "no-cache"); // for old browsers res.setDateHeader("Expires", 0); // to be double-safe + // entrails is the map of logging information + final Map<String,Object> entrails = new HashMap<String,Object>(); + + // request attribute to keep + entrails.put("referer", req.getHeader("Referer")); + entrails.put("method", req.getMethod()); + entrails.put("ipaddress", req.getRemoteAddr()); + entrails.put("user-agent", req.getHeader("User-Agent")); + entrails.put("user-id", SearchServlet.getCookieValue(req, "SesamID")); + entrails.put("user", SearchServlet.getCookieValue(req, "SesamUser")); + if(req.getRequestURI().startsWith(CEREMONIAL)){ // ceremonial boomerang @@ -94,16 +105,6 @@ final String destination = url.substring( url.indexOf("/", url.indexOf(CEREMONIAL) + CEREMONIAL.length() + 1) + 1); - final Map<String,String> entrails = new HashMap<String,String>(); - - // request attribute to keep - entrails.put("referer", req.getHeader("Referer")); - entrails.put("method", req.getMethod()); - entrails.put("ipaddress", req.getRemoteAddr()); - entrails.put("user-agent", req.getHeader("User-Agent")); - entrails.put("user-id", SearchServlet.getCookieValue(req, "SesamID")); - entrails.put("user", SearchServlet.getCookieValue(req, "SesamUser")); - // the grub details to add if(0 < grub.length()){ final StringTokenizer tokeniser = new StringTokenizer(grub, ";"); @@ -138,7 +139,8 @@ // hunting boomerang, just grub, and the grub comes as clean parameters. final DataModel datamodel = (DataModel) req.getSession().getAttribute(DataModel.KEY); - kangerooGrub(datamodel.getParameters().getValues()); + entrails.putAll(datamodel.getParameters().getValues()); + kangerooGrub(entrails); } Modified: trunk/war/src/main/webapp/WEB-INF/jsp/500.jsp =================================================================== --- trunk/war/src/main/webapp/WEB-INF/jsp/500.jsp 2008-10-24 21:28:52 UTC (rev 6891) +++ trunk/war/src/main/webapp/WEB-INF/jsp/500.jsp 2008-10-25 19:11:23 UTC (rev 6892) @@ -7,19 +7,22 @@ <search:velocity template="/pages/500"/> </c:catch> -<%-- At the bare minimum display the following --%> -<c:if test="${!empty error || !empty Missing_pages500_Template}"> +<%-- If this site does not exist redirect to super domain (for now hardcoded to sesam.com) --%> +<c:if test="${!empty error}"><c:redirect url="http://sesam.com"/></c:if> + +<%-- At the bare minimum display the following basic 500 error page --%> +<c:if test="${!empty Missing_pages500_Template}"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>500 - Internal error</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> - <link rel="icon" href="/images/favicon.gif" type="image/x-icon" /> - <link rel="shortcut icon" href="/images/favicon.gif" type="image/x-icon" /> + <link rel="icon" href="http://sesam.com/images/favicon.gif" type="image/x-icon" /> + <link rel="shortcut icon" href="http://sesam.com/images/favicon.gif" type="image/x-icon" /> </head> <body style="margin:0; padding:0;"> - <div style="width:100%; height:6px; background:#A6408E;"><img src="/images/pix.gif" width="1" height="6" alt="" /></div> - <img src="/images/logo.jpg" width="146" height="44" style="padding:20px 0 10px 30px;" alt="logo" /> + <div style="width:100%; height:6px; background:#A6408E;"><img src="http://sesam.com/images/pix.gif" width="1" height="6" alt="" /></div> + <img src="http://sesam.com/images/logo.png" width="146" height="44" style="padding:20px 0 10px 30px;" alt="logo" /> <div style="padding-left:30px; font-size:12px; font-family: arial, sans-serif;"> <p>500 Internal Server Error The server encountered an unexpected condition which prevented it from fulfilling the request.</p> _______________________________________________ Kernel-commits mailing list [email protected] http://sesat.no/mailman/listinfo/kernel-commits
