You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

OsgiVaadinPortletService.java 1.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * Copyright 2000-2016 Vaadin Ltd.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  5. * use this file except in compliance with the License. You may obtain a copy of
  6. * the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  12. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  13. * License for the specific language governing permissions and limitations under
  14. * the License.
  15. */
  16. package com.vaadin.osgi.liferay;
  17. import com.vaadin.server.DeploymentConfiguration;
  18. import com.vaadin.server.ServiceException;
  19. import com.vaadin.server.VaadinPortlet;
  20. import com.vaadin.server.VaadinPortletService;
  21. import com.vaadin.server.VaadinPortletSession;
  22. import com.vaadin.server.VaadinRequest;
  23. import com.vaadin.server.VaadinSession;
  24. import com.vaadin.ui.UI;
  25. /**
  26. * {@link VaadinPortletService} class that uses the {@link OsgiUIProvider} to
  27. * configure the {@link UI} class for a {@link VaadinPortlet}.
  28. * <p>
  29. * This only applies to Liferay Portal 7+ with OSGi support.
  30. *
  31. * @author Sampsa Sohlman
  32. *
  33. * @since 8.1
  34. */
  35. @SuppressWarnings("serial")
  36. public class OsgiVaadinPortletService extends VaadinPortletService {
  37. private OsgiUIProvider osgiUIProvider;
  38. public OsgiVaadinPortletService(VaadinPortlet portlet,
  39. DeploymentConfiguration deploymentConfiguration,
  40. OsgiUIProvider osgiUIProvider) throws ServiceException {
  41. super(portlet, deploymentConfiguration);
  42. this.osgiUIProvider = osgiUIProvider;
  43. }
  44. @Override
  45. protected VaadinSession createVaadinSession(VaadinRequest request)
  46. throws ServiceException {
  47. VaadinSession vaadinSession = new VaadinPortletSession(this);
  48. vaadinSession.addUIProvider(osgiUIProvider);
  49. return vaadinSession;
  50. }
  51. }