Author: ssmiweve
Date: 2009-10-30 16:09:01 +0100 (Fri, 30 Oct 2009)
New Revision: 7306

Modified:
   trunk/
   
trunk/generic.sesam/search-command-control/default/src/main/java/no/sesat/search/mode/command/SolrSearchCommand.java
   trunk/generic.sesam/sesam.com/war/src/main/webapp/WEB-INF/web.xml
   trunk/mojo/src/main/java/no/sesat/mojo/DeploySesatWarfilesMojo.java
   
trunk/query-api/src/main/java/no/sesat/search/query/parser/AbstractClause.java
   
trunk/query-api/src/main/java/no/sesat/search/query/token/DeadTokenEvaluationEngineImpl.java
   
trunk/query-api/src/main/java/no/sesat/search/query/token/EvaluationRuntimeException.java
   trunk/war/pom.xml
   trunk/war/src/main/java/no/sesat/search/http/filters/UserFilter.java
   trunk/war/src/main/webapp/robots.jsp
Log:
svn merge http://sesat.no/svn/sesat-kernel/branches/2.18/



Property changes on: trunk
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/2.10:4629-4745
/branches/2.11:4751-4933
/branches/2.12:4943-5106
/branches/2.13:5177-5378
/branches/2.14:5379-5508
/branches/2.15:5746-5995
/branches/2.16:6024-6122,6344-6499
/branches/2.16.0:6154-6343
/branches/2.17:6340-6980
/branches/2.18:6960-7295
/branches/2.6:3862-3877
/branches/2.7:4074-4160
/branches/2.8:4295-4446
/branches/2.9:4457-4626
/branches/MAP_SEARCHv2:3935-4544
/trunk:1-6959
   + /branches/2.10:4629-4745
/branches/2.11:4751-4933
/branches/2.12:4943-5106
/branches/2.13:5177-5378
/branches/2.14:5379-5508
/branches/2.15:5746-5995
/branches/2.16:6024-6122,6344-6499
/branches/2.16.0:6154-6343
/branches/2.17:6340-6980
/branches/2.18:6960-7305
/branches/2.6:3862-3877
/branches/2.7:4074-4160
/branches/2.8:4295-4446
/branches/2.9:4457-4626
/branches/MAP_SEARCHv2:3935-4544
/trunk:1-6959

Modified: 
trunk/generic.sesam/search-command-control/default/src/main/java/no/sesat/search/mode/command/SolrSearchCommand.java
===================================================================
--- 
trunk/generic.sesam/search-command-control/default/src/main/java/no/sesat/search/mode/command/SolrSearchCommand.java
        2009-10-15 10:44:45 UTC (rev 7305)
+++ 
trunk/generic.sesam/search-command-control/default/src/main/java/no/sesat/search/mode/command/SolrSearchCommand.java
        2009-10-30 15:09:01 UTC (rev 7306)
@@ -242,6 +242,8 @@
                 item = item.addField(entry.getValue(), 
(String)doc.getFieldValue(entry.getKey()));
             }else if(value instanceof Serializable){
                 item = item.addObjectField(entry.getValue(), 
(Serializable)doc.getFieldValue(entry.getKey()));
+            }else if(null == value) {
+                LOG.debug("Unable to add to ResultItem, field " + 
entry.getKey() + " does not exist");
             }else{
                 LOG.warn("Unable to add to ResultItem this non Serializable 
object: " + value);
             }

Modified: trunk/generic.sesam/sesam.com/war/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/generic.sesam/sesam.com/war/src/main/webapp/WEB-INF/web.xml   
2009-10-15 10:44:45 UTC (rev 7305)
+++ trunk/generic.sesam/sesam.com/war/src/main/webapp/WEB-INF/web.xml   
2009-10-30 15:09:01 UTC (rev 7306)
@@ -38,7 +38,8 @@
         
<servlet-class>no.sesat.commons.resourcefeed.ResourceServlet</servlet-class>
         <init-param>
             <param-name>ipaddresses.allowed</param-name>
-            <param-value>80.91.33.</param-value>
+            <!-- By default allow everybody to read the private resources 
(generic.sesam is open sourced afterall) -->
+            <param-value>0,1,2,3,4,5,6,7,8,9</param-value>
         </init-param>
         <init-param>
             <param-name>resources.restricted</param-name>

Modified: trunk/mojo/src/main/java/no/sesat/mojo/DeploySesatWarfilesMojo.java
===================================================================
--- trunk/mojo/src/main/java/no/sesat/mojo/DeploySesatWarfilesMojo.java 
2009-10-15 10:44:45 UTC (rev 7305)
+++ trunk/mojo/src/main/java/no/sesat/mojo/DeploySesatWarfilesMojo.java 
2009-10-30 15:09:01 UTC (rev 7306)
@@ -281,10 +281,12 @@
 
     /** {...@inheritdoc}
      */
+    @Override
     public void execute() throws MojoExecutionException{
 
-        // only ever interested in war projects. silently ignore other 
projects.
-        if("war".equals(project.getPackaging())){
+        // only ever interested in war and ear projects. silently ignore other 
projects.
+        final String ext = project.getPackaging();
+        if("war".equals(ext) || "ear".equals(ext)){
 
             pushFields();
 

Modified: 
trunk/query-api/src/main/java/no/sesat/search/query/parser/AbstractClause.java
===================================================================
--- 
trunk/query-api/src/main/java/no/sesat/search/query/parser/AbstractClause.java  
    2009-10-15 10:44:45 UTC (rev 7305)
+++ 
trunk/query-api/src/main/java/no/sesat/search/query/parser/AbstractClause.java  
    2009-10-30 15:09:01 UTC (rev 7306)
@@ -1,4 +1,4 @@
-/* Copyright (2005-2008) Schibsted ASA
+/* Copyright (2005-2009) Schibsted ASA
  * This file is part of SESAT.
  *
  *   SESAT is free software: you can redistribute it and/or modify
@@ -27,6 +27,7 @@
 import no.sesat.commons.ref.ReferenceMap;
 import no.sesat.search.query.Clause;
 import no.sesat.commons.visitor.Visitor;
+import 
no.sesat.search.query.token.DeadTokenEvaluationEngineImpl.DeadEvaluationRuntimeException;
 import no.sesat.search.query.token.TokenEvaluator;
 import no.sesat.search.query.token.TokenEvaluationEngine;
 import no.sesat.search.query.token.TokenPredicate;
@@ -180,6 +181,9 @@
                     success = false;
                     LOG.error(ERR_FAILED_TO_FIND_ALL_PREDICATES + currTerm);
                 }
+            }catch(DeadEvaluationRuntimeException dere){
+                success |= false;
+                // don't log this as it is intentional evaluation failure
             }catch(EvaluationRuntimeException ee){
                 if(success){
                     success = false;
@@ -211,6 +215,7 @@
      * Does not include any field values (eg "firstname:").
      * @return the term for this clause.
      */
+    @Override
     public String getTerm() {
         return term;
     }
@@ -220,6 +225,7 @@
      * The set is unmodifiable.
      * @return set of knownPredicates.
      */
+    @Override
     public Set<TokenPredicate> getKnownPredicates() {
         return knownPredicates;
     }
@@ -229,11 +235,13 @@
      * The set is unmodifiable.
      * @return set of possiblePredicates.
      */
+    @Override
     public Set<TokenPredicate> getPossiblePredicates() {
         return possiblePredicates;
     }
 
 
+    @Override
     public void accept(final Visitor visitor) {
         visitor.visit(this);
     }

Modified: 
trunk/query-api/src/main/java/no/sesat/search/query/token/DeadTokenEvaluationEngineImpl.java
===================================================================
--- 
trunk/query-api/src/main/java/no/sesat/search/query/token/DeadTokenEvaluationEngineImpl.java
        2009-10-15 10:44:45 UTC (rev 7305)
+++ 
trunk/query-api/src/main/java/no/sesat/search/query/token/DeadTokenEvaluationEngineImpl.java
        2009-10-30 15:09:01 UTC (rev 7306)
@@ -1,5 +1,5 @@
 /*
- * Copyright (2008) Schibsted ASA
+ * Copyright (2008-2009) Schibsted ASA
  * This file is part of SESAT.
  *
  *   SESAT is free software: you can redistribute it and/or modify
@@ -27,6 +27,8 @@
  */
 public final class DeadTokenEvaluationEngineImpl extends 
TokenEvaluationEngineImpl {
 
+    private static final String DEAD_EXCEPTION_TITLE = "DEAD_EVALUATOR";
+
     public DeadTokenEvaluationEngineImpl(final Context cxt) {
         super(cxt);
     }
@@ -38,8 +40,13 @@
 
     @Override
     public boolean evaluate(final TokenPredicate token) {
-        throw new EvaluationRuntimeException(
-                new EvaluationException("DEAD_EVALUATOR", null));
+        throw new DeadEvaluationRuntimeException();
     }
 
+    public static final class DeadEvaluationRuntimeException extends 
EvaluationRuntimeException{
+        DeadEvaluationRuntimeException(){
+            super(new EvaluationException(DEAD_EXCEPTION_TITLE, null));
+        }
+    }
+
 }

Modified: 
trunk/query-api/src/main/java/no/sesat/search/query/token/EvaluationRuntimeException.java
===================================================================
--- 
trunk/query-api/src/main/java/no/sesat/search/query/token/EvaluationRuntimeException.java
   2009-10-15 10:44:45 UTC (rev 7305)
+++ 
trunk/query-api/src/main/java/no/sesat/search/query/token/EvaluationRuntimeException.java
   2009-10-30 15:09:01 UTC (rev 7306)
@@ -1,4 +1,4 @@
-/* Copyright (2008) Schibsted ASA
+/* Copyright (2008-2009) Schibsted ASA
  * This file is part of SESAT.
  *
  *   SESAT is free software: you can redistribute it and/or modify
@@ -21,7 +21,7 @@
  * Note that a similar named EvaluationException exists within this package.
  * @version $Id$
  */
-public final class EvaluationRuntimeException extends RuntimeException {
+public class EvaluationRuntimeException extends RuntimeException {
     public EvaluationRuntimeException(final EvaluationException vflqe) {
         super(vflqe);
     }

Modified: trunk/war/pom.xml
===================================================================
--- trunk/war/pom.xml   2009-10-15 10:44:45 UTC (rev 7305)
+++ trunk/war/pom.xml   2009-10-30 15:09:01 UTC (rev 7306)
@@ -197,7 +197,6 @@
         <dependency>
             <groupId>sesat</groupId>
             <artifactId>sesat-user-api</artifactId>
-            <scope>compile</scope>
         </dependency>
 
         <dependency>

Modified: trunk/war/src/main/java/no/sesat/search/http/filters/UserFilter.java
===================================================================
--- trunk/war/src/main/java/no/sesat/search/http/filters/UserFilter.java        
2009-10-15 10:44:45 UTC (rev 7305)
+++ trunk/war/src/main/java/no/sesat/search/http/filters/UserFilter.java        
2009-10-30 15:09:01 UTC (rev 7306)
@@ -49,6 +49,8 @@
  * The user's manual logging in with username and password
  *  must be performed in a separate application that fronts to UserService.
  *
+ * @xxx it may be more appropriate that this class belongs in sesat-user 
project?
+ *
  * @version <tt>$Id$</tt>
  */
 public final class UserFilter implements Filter {
@@ -57,6 +59,10 @@
 
     private static final Logger LOG = Logger.getLogger(UserFilter.class);
 
+    private static final String DISABLE_LOGOUT = "sesat.user.logout.disabled";
+    private static final String ACTION_PARAMETER = "action";
+    private static final String LOGOUT_PARAMETER_VALUE = "logout";
+
     // Attributes ----------------------------------------------------
 
     // Static --------------------------------------------------------
@@ -79,6 +85,7 @@
      * @exception IOException Thrown if an input/output error occurs
      * @exception ServletException Thrown if a servlet error occurs
      */
+    @Override
     public void doFilter(
             final ServletRequest request,
             final ServletResponse response,
@@ -89,12 +96,15 @@
             performAutomaticLogin((HttpServletRequest) request, 
(HttpServletResponse) response);
 
         }
-        chain.doFilter(request, response);
+        if(!response.isCommitted()){
+            chain.doFilter(request, response);
+        }
     }
 
     /**
      * Destroy method for this filter.
      */
+    @Override
     public void destroy() {
     }
 
@@ -104,6 +114,7 @@
      *
      * @param filterConfig the filter configuration
      */
+    @Override
     public void init(final FilterConfig filterConfig) {
     }
 
@@ -127,14 +138,13 @@
         final BasicUserService basicUserService = 
getBasicUserService(datamodel);
 
         if (null != basicUserService) {
-
             final String loginKey = UserCookieUtil.getUserLoginCookie(request);
             final boolean isLegalLoginKey = 
basicUserService.isLegalLoginKey(loginKey);
 
             final BasicUser user = datamodel.getUser().getUser();
             final Date updateTimestamp = 
UserCookieUtil.getUserUpdateCookie(request);
 
-            final boolean actionLogout = 
"logout".equals(request.getParameter("action"));
+            final boolean actionLogout = 
LOGOUT_PARAMETER_VALUE.equals(request.getParameter(ACTION_PARAMETER));
 
             if (user == null && isLegalLoginKey) {
 
@@ -148,30 +158,21 @@
 
                 // Remove the logout from the url to prevent problems with 
sesamBackUrl.
                 if (actionLogout) {
-                    final String strippedUrl = request.getRequestURL() + "?"
-                            + request.getQueryString().substring(0, 
request.getQueryString().indexOf("&action"));
-                    redirect(strippedUrl, response);
-                }
 
-            } else if (user != null && isLegalLoginKey) {
-                if (!isLoginKeyLegalForUser(loginKey, user)) {
+                    final String queryString = request.getQueryString()
+                            .replaceFirst("&?" + ACTION_PARAMETER + '=' + 
LOGOUT_PARAMETER_VALUE, "");
 
-                    // Check if the logged in user is the one found in the 
login key
-                    logout(datamodel, basicUserService, response);
-                    loginUsingCookie(loginKey, datamodel, basicUserService, 
response);
+                    redirect(request.getRequestURL() + "?" + queryString, 
response);
+                }
 
-                } else if (user.isDirty(updateTimestamp)) {
+            } else if (null != user && isLegalLoginKey && 
user.isDirty(updateTimestamp)) {
 
                     // Check if the user object is dirty, refresh if needed.
-                    LOG.info("Logged in user dirty, refreshes: " + 
user.getUsername());
+                    LOG.info("Logged in user dirty, refreshes: " + 
user.getFullName());
                     
datamodel.getUser().setUser(basicUserService.refreshUser(user));
-                }
             }
-
         }else{
-
             LOG.debug("Couldn't find the basic user service.");
-            return;
         }
     }
 
@@ -216,7 +217,15 @@
 
     /**
      * Method used to reset a session totally.
+     * It removes the user object from the datamodel, calls 
basicUserService.invalidateLogin(loginKey)
+     *  and resets the loginKey cookie to its default value.
      *
+     * The invalidateLogin(..) call and cookie reset can be disabled by 
setting in the skin's configuration.properties
+     * sesat.user.logout.disabled=true
+     *
+     * but the user will always be removed from the datamodel,
+     *  and expected to be re-inserted on the next loginUsingCookie(..) call.
+     *
      * @param datamodel the datamodel
      * @param userService the user service
      * @param response the request response
@@ -226,14 +235,19 @@
             final BasicUserService userService,
             final HttpServletResponse response) {
 
-        final BasicUser user = datamodel.getUser().getUser();
-        LOG.info("Logout: " + user.getUsername());
+        final SiteConfiguration siteConf = 
datamodel.getSite().getSiteConfiguration();
 
-        if (userService.isLegalLoginKey(user.getNextLoginKey())) {
-            userService.invalidateLogin(user.getNextLoginKey());
+        if(!Boolean.parseBoolean(siteConf.getProperty(DISABLE_LOGOUT))){
+
+            final BasicUser user = datamodel.getUser().getUser();
+            LOG.info("Logout: " + user.getFullName());
+
+            if (userService.isLegalLoginKey(user.getNextLoginKey())) {
+                userService.invalidateLogin(user.getNextLoginKey());
+            }
+
+            UserCookieUtil.setUserLoginCookieDefault(response);
         }
-
-        UserCookieUtil.setUserLoginCookieDefault(response);
         datamodel.getUser().setUser(null);
     }
 
@@ -253,13 +267,6 @@
         }
     }
 
-    private static boolean isLoginKeyLegalForUser(final String loginKey, final 
BasicUser user) {
-
-        // The user id in the login key must be the same as in the user object.
-        return user.getUserId().toString().equals(
-            loginKey.substring(0, 
loginKey.indexOf(BasicUserService.LOGIN_KEY_SEPARATOR)));
-    }
-
     private static void redirect(final String url, final HttpServletResponse 
response) {
 
         try {

Modified: trunk/war/src/main/webapp/robots.jsp
===================================================================
--- trunk/war/src/main/webapp/robots.jsp        2009-10-15 10:44:45 UTC (rev 
7305)
+++ trunk/war/src/main/webapp/robots.jsp        2009-10-30 15:09:01 UTC (rev 
7306)
@@ -1,24 +1,3 @@
-<%-- Copyright (2007) Schibsted ASA
- *   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/>.
---%>
-<%@ page
-        language="java"
-        contentType="text/plain; charset=utf-8"
-        pageEncoding="UTF-8"
-        %>
+<%@ page language="java" contentType="text/plain; charset=utf-8" 
pageEncoding="UTF-8" %>
 <%@ taglib uri="/WEB-INF/SearchPortal.tld" prefix="search" %>
-
 <search:velocity template="/pages/robots"/>

_______________________________________________
Kernel-commits mailing list
[email protected]
http://sesat.no/mailman/listinfo/kernel-commits

Reply via email to