| /** |
| * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany) |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License 2.0 |
| * which accompanies this distribution, and is available at |
| * https://www.eclipse.org/legal/epl-2.0/ |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| * |
| * Contributors: |
| * Florian Pirchner - Initial implementation |
| */ |
| package org.eclipse.osbp.runtime.web.vaadin.osgi.servlet; |
| |
| import javax.servlet.http.HttpServletRequest; |
| |
| import com.vaadin.server.DeploymentConfiguration; |
| import com.vaadin.server.ServiceException; |
| import com.vaadin.server.VaadinRequest; |
| import com.vaadin.server.VaadinServlet; |
| import com.vaadin.server.VaadinServletService; |
| import com.vaadin.server.VaadinSession; |
| |
| // TODO: Auto-generated Javadoc |
| /** |
| * The Class OSGiServletService. |
| */ |
| @SuppressWarnings("serial") |
| public class OSGiServletService extends VaadinServletService { |
| |
| /** The factory. */ |
| private final IVaadinSessionFactory factory; |
| |
| /** |
| * Instantiates a new OS gi servlet service. |
| * |
| * @param servlet |
| * the servlet |
| * @param deploymentConfiguration |
| * the deployment configuration |
| * @param factory |
| * the factory |
| * @throws ServiceException |
| * the service exception |
| */ |
| public OSGiServletService(VaadinServlet servlet, |
| DeploymentConfiguration deploymentConfiguration, |
| IVaadinSessionFactory factory) throws ServiceException { |
| super(servlet, deploymentConfiguration); |
| this.factory = factory; |
| } |
| |
| /* (non-Javadoc) |
| * @see com.vaadin.server.VaadinServletService#getConfiguredWidgetset(com.vaadin.server.VaadinRequest) |
| */ |
| @Override |
| public String getConfiguredWidgetset(VaadinRequest request) { |
| return super.getConfiguredWidgetset(request); |
| } |
| |
| /* (non-Javadoc) |
| * @see com.vaadin.server.VaadinService#getClassLoader() |
| */ |
| @Override |
| public ClassLoader getClassLoader() { |
| return getClass().getClassLoader(); |
| } |
| |
| /* (non-Javadoc) |
| * @see com.vaadin.server.VaadinService#createVaadinSession(com.vaadin.server.VaadinRequest) |
| */ |
| @Override |
| protected VaadinSession createVaadinSession(VaadinRequest request) |
| throws ServiceException { |
| return factory.createSession(request, getCurrentServletRequest()); |
| } |
| |
| /** |
| * Creates new instances of vaadin sessions. |
| */ |
| public interface IVaadinSessionFactory { |
| |
| /** |
| * Returns a new instance of a vaadin session. |
| * |
| * @param request |
| * the request |
| * @param httpServletRequest |
| * the http servlet request |
| * @return the vaadin session |
| */ |
| VaadinSession createSession(VaadinRequest request, |
| HttpServletRequest httpServletRequest); |
| } |
| } |