commit daf5d5b489061ed37c8b3f3d755b502bfc7e73c4
Author: Andreas Kohlbecker <a.kohlbecker@bgbm.org>
Date:   Fri Nov 3 12:05:08 2017 +0100

    ref #7046 removing request start and end listener classes

diff --git a/src/main/java/eu/etaxonomy/cdm/addon/config/CdmVaadinConfiguration.java b/src/main/java/eu/etaxonomy/cdm/addon/config/CdmVaadinConfiguration.java
index a3aa12e8..5b4d5351 100644
--- a/src/main/java/eu/etaxonomy/cdm/addon/config/CdmVaadinConfiguration.java
+++ b/src/main/java/eu/etaxonomy/cdm/addon/config/CdmVaadinConfiguration.java
@@ -27,9 +27,6 @@ import org.springframework.context.annotation.FilterType;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.security.authentication.AuthenticationProvider;
 
-import com.vaadin.server.DeploymentConfiguration;
-import com.vaadin.server.ServiceException;
-import com.vaadin.server.VaadinServletService;
 import com.vaadin.spring.annotation.EnableVaadin;
 import com.vaadin.spring.annotation.SpringUI;
 import com.vaadin.spring.annotation.UIScope;
@@ -43,7 +40,6 @@ import eu.etaxonomy.cdm.common.ConfigFileUtil;
 import eu.etaxonomy.cdm.dataInserter.RegistrationRequiredDataInserter;
 import eu.etaxonomy.cdm.opt.config.DataSourceConfigurer;
 import eu.etaxonomy.cdm.vaadin.security.annotation.EnableAnnotationBasedAccessControl;
-import eu.etaxonomy.cdm.vaadin.server.CdmSpringVaadinServletService;
 import eu.etaxonomy.cdm.vaadin.ui.ConceptRelationshipUI;
 import eu.etaxonomy.cdm.vaadin.ui.DistributionStatusUI;
 import eu.etaxonomy.cdm.vaadin.ui.RegistrationUI;
@@ -96,22 +92,6 @@ public class CdmVaadinConfiguration implements ApplicationContextAware  {
 
         private static final long serialVersionUID = -2615042297393028775L;
 
-        @Override
-        protected VaadinServletService createServletService(
-                DeploymentConfiguration deploymentConfiguration)
-                throws ServiceException {
-
-            //  - The SpringVaadinServletService is needed when using a custom service URL
-            //  - The CdmSpringVaadinServletService allows to attach listeners to the requestEnd and
-            //    requestStart method this is important for proper unbinding of Conversations from
-            //    the request threads.
-            //    see ViewScopeConversationHolder
-            CdmSpringVaadinServletService service = new CdmSpringVaadinServletService(
-                    this, deploymentConfiguration, getServiceUrlPath());
-            service.init();
-            return service;
-        }
-
         /**
          *
         @SuppressWarnings("serial")
diff --git a/src/main/java/eu/etaxonomy/cdm/vaadin/server/CdmSpringVaadinServletService.java b/src/main/java/eu/etaxonomy/cdm/vaadin/server/CdmSpringVaadinServletService.java
deleted file mode 100644
index 6d1c8d05..00000000
--- a/src/main/java/eu/etaxonomy/cdm/vaadin/server/CdmSpringVaadinServletService.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/**
-* Copyright (C) 2017 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-package eu.etaxonomy.cdm.vaadin.server;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.vaadin.server.DeploymentConfiguration;
-import com.vaadin.server.ServiceException;
-import com.vaadin.server.VaadinRequest;
-import com.vaadin.server.VaadinResponse;
-import com.vaadin.server.VaadinServlet;
-import com.vaadin.server.VaadinSession;
-import com.vaadin.spring.server.SpringVaadinServletService;
-
-/**
- * @author a.kohlbecker
- * @since Jul 4, 2017
- *
- */
-public class CdmSpringVaadinServletService extends SpringVaadinServletService {
-
-    private static final long serialVersionUID = 5956798985059823698L;
-
-    List<RequestEndListener> requestEndListeners = new ArrayList<>();
-
-    List<RequestStartListener> requestStartListeners = new ArrayList<>();
-
-    /**
-     * @param servlet
-     * @param deploymentConfiguration
-     * @param serviceUrl
-     * @throws ServiceException
-     */
-    public CdmSpringVaadinServletService(VaadinServlet servlet, DeploymentConfiguration deploymentConfiguration,
-            String serviceUrl) throws ServiceException {
-        super(servlet, deploymentConfiguration, serviceUrl);
-    }
-
-    @Override
-    public void requestStart(VaadinRequest request, VaadinResponse response) {
-        super.requestStart(request, response);
-        requestStartListeners.forEach(l -> l.onRequestStart(request));
-    }
-
-    @Override
-    public void requestEnd(VaadinRequest request, VaadinResponse response,
-            VaadinSession session) {
-        super.requestEnd(request, response, session);
-        requestEndListeners.forEach(l -> l.onRequestEnd(request, session));
-    }
-
-    public void addRequestStartListener(RequestStartListener requestStartListener){
-        requestStartListeners.add(requestStartListener);
-    }
-
-    public void removeRequestStartListener(RequestStartListener requestStartListener){
-        requestStartListeners.remove(requestStartListener);
-    }
-
-    public void addRequestEndListener(RequestEndListener requestEndListener){
-        requestEndListeners.add(requestEndListener);
-    }
-
-    public void removeRequestEndListener(RequestEndListener requestEndListener){
-        requestEndListeners.remove(requestEndListener);
-    }
-
-
-
-
-
-
-}
diff --git a/src/main/java/eu/etaxonomy/cdm/vaadin/server/RequestEndListener.java b/src/main/java/eu/etaxonomy/cdm/vaadin/server/RequestEndListener.java
deleted file mode 100644
index 61110a7d..00000000
--- a/src/main/java/eu/etaxonomy/cdm/vaadin/server/RequestEndListener.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/**
-* Copyright (C) 2017 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-package eu.etaxonomy.cdm.vaadin.server;
-
-import com.vaadin.server.VaadinRequest;
-import com.vaadin.server.VaadinSession;
-
-/**
- * @author a.kohlbecker
- * @since Jul 4, 2017
- *
- */
-public interface RequestEndListener {
-
-    public void onRequestEnd(VaadinRequest request, VaadinSession session);
-
-}
diff --git a/src/main/java/eu/etaxonomy/cdm/vaadin/server/RequestStartListener.java b/src/main/java/eu/etaxonomy/cdm/vaadin/server/RequestStartListener.java
deleted file mode 100644
index 83520b76..00000000
--- a/src/main/java/eu/etaxonomy/cdm/vaadin/server/RequestStartListener.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
-* Copyright (C) 2017 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-package eu.etaxonomy.cdm.vaadin.server;
-
-import com.vaadin.server.VaadinRequest;
-
-/**
- * @author a.kohlbecker
- * @since Jul 4, 2017
- *
- */
-public interface RequestStartListener {
-
-    public void onRequestStart(VaadinRequest request);
-
-}
diff --git a/src/main/java/eu/etaxonomy/cdm/vaadin/session/IntraViewConversationDirector.java b/src/main/java/eu/etaxonomy/cdm/vaadin/session/IntraViewConversationDirector.java
deleted file mode 100644
index 0d2b1b1a..00000000
--- a/src/main/java/eu/etaxonomy/cdm/vaadin/session/IntraViewConversationDirector.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/**
-* Copyright (C) 2017 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-package eu.etaxonomy.cdm.vaadin.session;
-
-import eu.etaxonomy.cdm.vaadin.server.RequestEndListener;
-
-/**
- * @author a.kohlbecker
- * @since Jul 6, 2017
- *
- */
-public interface IntraViewConversationDirector extends ConversationDirector, RequestEndListener {
-
-}
diff --git a/src/main/java/eu/etaxonomy/vaadin/mvp/AbstractEditorPresenter.java b/src/main/java/eu/etaxonomy/vaadin/mvp/AbstractEditorPresenter.java
index c08f371e..6cbc84d5 100644
--- a/src/main/java/eu/etaxonomy/vaadin/mvp/AbstractEditorPresenter.java
+++ b/src/main/java/eu/etaxonomy/vaadin/mvp/AbstractEditorPresenter.java
@@ -13,16 +13,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.ApplicationEventPublisher;
 import org.springframework.context.event.EventListener;
 
-import com.vaadin.server.ServletPortletHelper;
-import com.vaadin.server.VaadinRequest;
-import com.vaadin.server.VaadinService;
-import com.vaadin.server.VaadinSession;
-import com.vaadin.ui.UI;
-
 import eu.etaxonomy.cdm.vaadin.event.AbstractEditorAction;
-import eu.etaxonomy.cdm.vaadin.server.CdmSpringVaadinServletService;
-import eu.etaxonomy.cdm.vaadin.server.RequestEndListener;
-import eu.etaxonomy.cdm.vaadin.server.RequestStartListener;
 import eu.etaxonomy.vaadin.mvp.event.EditorDeleteEvent;
 import eu.etaxonomy.vaadin.mvp.event.EditorPreSaveEvent;
 import eu.etaxonomy.vaadin.mvp.event.EditorSaveEvent;
@@ -34,8 +25,7 @@ import eu.etaxonomy.vaadin.mvp.event.EditorViewEvent;
  * @since Apr 5, 2017
  *
  */
-public abstract class AbstractEditorPresenter<DTO extends Object, V extends ApplicationView<?>> extends AbstractPresenter<V>
-implements RequestEndListener, RequestStartListener {
+public abstract class AbstractEditorPresenter<DTO extends Object, V extends ApplicationView<?>> extends AbstractPresenter<V> {
 
 
     private static final long serialVersionUID = -6677074110764145236L;
@@ -140,114 +130,6 @@ implements RequestEndListener, RequestStartListener {
         return action.getSourceView() != null && getView().equals(action.getSourceView());
     }
 
-    @Override
-    protected void init(V view) {
-        super.init(view);
-        registerListeners();
-    }
-
-    @Override
-    public void onViewExit() {
-        super.onViewExit();
-        unregisterListeners();
-    }
-
-
-    // -------------------------------------------------------------------------
-
-    protected void registerListeners() {
-     // register as request start and end listener
-        VaadinService service = UI.getCurrent().getSession().getService();
-        if(service instanceof CdmSpringVaadinServletService){
-            logger.trace(String.format("~~~~~ %s register as request listener", _toString()));
-            ((CdmSpringVaadinServletService)service).addRequestEndListener(this);
-            if(logger.isTraceEnabled()){
-                ((CdmSpringVaadinServletService)service).addRequestStartListener(this);
-            }
-        } else {
-            throw new RuntimeException("Using the CdmSpringVaadinServletService is required for proper per view conversation handling");
-        }
-    }
-
-    /**
-    *
-    */
-   protected void unregisterListeners() {
-       VaadinService service = UI.getCurrent().getSession().getService();
-       if(service instanceof CdmSpringVaadinServletService){
-           logger.trace(String.format("~~~~~ %s un-register as request listener", _toString()));
-           ((CdmSpringVaadinServletService)service).removeRequestEndListener(this);
-           if(logger.isTraceEnabled()){
-               ((CdmSpringVaadinServletService)service).removeRequestStartListener(this);
-           }
-       } else {
-           throw new RuntimeException("Using the CdmSpringVaadinServletService is required for proper per view conversation handling");
-       }
-   }
-
-    /**
-     * <b>ONLY USED FOR LOGGING</b> when Level==TRACE
-     * {@inheritDoc}
-     */
-    @Override
-    public void onRequestStart(VaadinRequest request){
-
-        if(requestNeedsSession(request) ){
-
-            if(getView() instanceof AbstractPopupEditor){
-                Object bean = ((AbstractPopupEditor)getView()).getBean();
-                getSession().merge(bean);
-            }
-
-        } else {
-            // ignore hartbeat, fileupload, push etc
-            logger.trace("ignoring request:" + request.getPathInfo());
-        }
-    }
-
-    /**
-     * Returns <code>true</code> for:
-     * <ul>
-     *   <li>..</li>
-     * <ul>
-     *
-     * Return <code>false</code> for:
-     *
-     * <ul>
-     *   <li>UILD request in a existing view, like clicking on a button</li>
-     * <ul>
-     *
-     * @return
-    protected boolean isActiveView(){
-        return UI.getCurrent() != null && getView() != null && getView() == navigationManager.getCurrentView();
-    }
-     */
-
-    @Override
-    public void onRequestEnd(VaadinRequest request, VaadinSession session){
-
-        if(requestNeedsSession(request) ){
-            logger.trace("onRequestEnd() " + request.getPathInfo() + " " + _toString());
-
-        } else {
-            // ignore hartbeat, fileupload, push etc
-            logger.trace("ignoring request:" + request.getPathInfo());
-        }
-
-    }
-
-    /**
-     * @param request
-     * @return
-     */
-    protected boolean requestNeedsSession(VaadinRequest request) {
-        return !(
-                ServletPortletHelper.isAppRequest(request) // includes published file request
-             || ServletPortletHelper.isFileUploadRequest(request)
-             || ServletPortletHelper.isHeartbeatRequest(request)
-             || ServletPortletHelper.isPushRequest(request)
-             );
-    }
 
     protected abstract void saveBean(DTO bean);
 
