@Override protected Optional<Instantiator> loadInstantiators() throws ServiceException { Optional<Instantiator> instantiatorOptional = lookup(Instantiator.class); if (instantiatorOptional.isPresent()) { Instantiator instantiator = instantiatorOptional.get(); if (!instantiator.init(this)) { // Class unproxiedClass = ProxyUtils.getUnproxiedClass(instantiator.getClass()); throw new ServiceException( "Cannot init VaadinService because " + instantiator.getClass().getName() + " CDI bean init()" + " returned false."); } } else { throw new ServiceException( "Cannot init VaadinService " + "because no CDI instantiator bean found." ); } return instantiatorOptional; }
protected <T> Optional<T> lookup(Class<T> type) throws ServiceException { try { T instance = new BeanLookup<>(beanManager, type, SERVICE).lookup(); return Optional.ofNullable(instance); } catch (AmbiguousResolutionException e) { throw new ServiceException( "There are multiple eligible CDI " + type.getSimpleName() + " beans.", e); } }
private <T> Optional<T> lookup(Class<T> type) throws ServiceException { try { T instance = new BeanLookup<>(beanManager, type, SERVICE).lookup(); return Optional.ofNullable(instance); } catch (AmbiguousResolutionException e) { throw new ServiceException( "There are multiple eligible CDI " + type.getSimpleName() + " beans.", e); } }
protected <T> Optional<T> lookup(Class<T> type) throws ServiceException { try { T instance = new BeanLookup<>(beanManager, type, SERVICE).lookup(); return Optional.ofNullable(instance); } catch (AmbiguousResolutionException e) { throw new ServiceException( "There are multiple eligible CDI " + type.getSimpleName() + " beans.", e); } }
@Override protected Optional<Instantiator> loadInstantiators() throws ServiceException { Optional<Instantiator> instantiatorOptional = lookup(Instantiator.class); if (instantiatorOptional.isPresent()) { Instantiator instantiator = instantiatorOptional.get(); if (!instantiator.init(this)) { Class unproxiedClass = ProxyUtils.getUnproxiedClass(instantiator.getClass()); throw new ServiceException( "Cannot init VaadinService because " + unproxiedClass.getName() + " CDI bean init()" + " returned false."); } } else { throw new ServiceException( "Cannot init VaadinService " + "because no CDI instantiator bean found." ); } return instantiatorOptional; }
@Override protected Optional<Instantiator> loadInstantiators() throws ServiceException { Optional<Instantiator> instantiatorOptional = lookup(Instantiator.class); if (instantiatorOptional.isPresent()) { Instantiator instantiator = instantiatorOptional.get(); if (!instantiator.init(this)) { Class unproxiedClass = ProxyUtils.getUnproxiedClass(instantiator.getClass()); throw new ServiceException( "Cannot init VaadinService because " + unproxiedClass.getName() + " CDI bean init()" + " returned false."); } } else { throw new ServiceException( "Cannot init VaadinService " + "because no CDI instantiator bean found." ); } return instantiatorOptional; }
@Override protected Optional<Instantiator> loadInstantiators() throws ServiceException { Optional<Instantiator> spiInstantiator = super.loadInstantiators(); List<Instantiator> springInstantiators = context .getBeansOfType(Instantiator.class).values().stream() .filter(instantiator -> instantiator.init(this)) .collect(Collectors.toList()); if (spiInstantiator.isPresent() && !springInstantiators.isEmpty()) { throw new ServiceException( "Cannot init VaadinService because there are multiple eligible " + "instantiator implementations: Java SPI registered instantiator " + spiInstantiator.get() + " and Spring instantiator beans: " + springInstantiators); } if (!spiInstantiator.isPresent() && springInstantiators.isEmpty()) { Instantiator defaultInstantiator = new SpringInstantiator(this, context); defaultInstantiator.init(this); return Optional.of(defaultInstantiator); } return spiInstantiator.isPresent() ? spiInstantiator : springInstantiators.stream().findFirst(); }
@Override protected Optional<Instantiator> loadInstantiators() throws ServiceException { Optional<Instantiator> spiInstantiator = super.loadInstantiators(); List<Instantiator> springInstantiators = context .getBeansOfType(Instantiator.class).values().stream() .filter(instantiator -> instantiator.init(this)) .collect(Collectors.toList()); if (spiInstantiator.isPresent() && !springInstantiators.isEmpty()) { throw new ServiceException( "Cannot init VaadinService because there are multiple eligible " + "instantiator implementations: Java SPI registered instantiator " + spiInstantiator.get() + " and Spring instantiator beans: " + springInstantiators); } if (!spiInstantiator.isPresent() && springInstantiators.isEmpty()) { Instantiator defaultInstantiator = new SpringInstantiator(this, context); defaultInstantiator.init(this); return Optional.of(defaultInstantiator); } return spiInstantiator.isPresent() ? spiInstantiator : springInstantiators.stream().findFirst(); }
.collect(Collectors.toList()); if (instantiators.size() > 1) { throw new ServiceException( "Cannot init VaadinService because there are multiple eligible instantiator implementations: " + instantiators);
throw new ServiceException( "Handling of session expired failed", e); throw new ServiceException(e);
atmosphere = initAtmosphere(vaadinServletConfig); } catch (Exception e) { throw new ServiceException( "Failed to initialize Atmosphere for " + service.getServlet().getServletName()
throw new ServiceException(t);