private Class<WidgetsetInfo> findWidgetsetClass() { try { // We cannot naively use Class.forname without getting the correct // classloader // FIXME This might still fail with osgi ClassLoader tccl = VaadinService.getCurrent().getClassLoader(); Class<?> c = Class.forName(APP_WIDGETSET_NAME, true, tccl); // if not implementing the interface, possibly a @WebListener class // from an earlier version - ignore it if (WidgetsetInfo.class.isAssignableFrom(c)) { return (Class<WidgetsetInfo>) c; } } catch (ClassNotFoundException e) { // ClassNotFound is a normal case } return null; }
private LegacyApplication getApplication() { LegacyApplication application = VaadinSession.getCurrent() .getAttribute(LegacyApplication.class); if (application == null) { application = createApplication(); if (application == null) { return null; } VaadinSession.getCurrent().setAttribute(LegacyApplication.class, application); URL applicationUrl; try { applicationUrl = VaadinService.getCurrent() .getApplicationUrl(VaadinService.getCurrentRequest()); } catch (MalformedURLException e) { throw new RuntimeException(e); } application.doInit(applicationUrl); } if (application != null && !application.isRunning()) { VaadinSession.getCurrent().setAttribute(LegacyApplication.class, null); // Run again without a current application return getApplication(); } return application; }
LOGGER.debug("Clearing the session"); final WrappedSession session = currentRequest.getWrappedSession(); final String serviceName = VaadinService.getCurrent().getServiceName(); final Set<String> attributesToSpare = new HashSet<String>(); attributesToSpare.add(serviceName + ".lock");
/** * Check whether the legacy prefix "v" or the default prefix "vaadin" should * be used when writing designs. The property or context parameter * {@link Constants#SERVLET_PARAMETER_LEGACY_DESIGN_PREFIX} can be used to * switch to the legacy prefix. * * @since 7.5.7 * @return true to use the legacy prefix, false by default */ protected boolean isLegacyPrefixEnabled() { if (legacyDesignPrefix != null) { return legacyDesignPrefix.booleanValue(); } if (VaadinService.getCurrent() == null) { // This will happen at least in JUnit tests. return false; } DeploymentConfiguration configuration = VaadinService.getCurrent() .getDeploymentConfiguration(); legacyDesignPrefix = configuration.getApplicationOrSystemProperty( Constants.SERVLET_PARAMETER_LEGACY_DESIGN_PREFIX, "false") .equals("true"); return legacyDesignPrefix.booleanValue(); }
LOGGER.debug("Clearing the session"); final WrappedSession session = currentRequest.getWrappedSession(); final String serviceName = VaadinService.getCurrent().getServiceName(); final Set<String> attributesToSpare = new HashSet<String>(); attributesToSpare.add(serviceName + ".lock");
/** * Creates and binds a TouchKitSettings instance to the * {@link VaadinService} instance, which is automatically fetched from a * thread local. */ public TouchKitSettings() { this(VaadinService.getCurrent()); }
@Override public VaadinService getObject() throws Exception { final VaadinService vaadinService = VaadinService.getCurrent(); if (vaadinService == null) { throw new IllegalStateException("No VaadinService bound to current thread"); } return vaadinService; }
@Override public VaadinService getObject() throws Exception { final VaadinService vaadinService = VaadinService.getCurrent(); if (vaadinService == null) { throw new IllegalStateException("No VaadinService bound to current thread"); } return vaadinService; }
@Override public File applicationBaseDirectory() { if (VaadinService.getCurrent() != null) { File baseDir = VaadinService.getCurrent() .getBaseDirectory(); if (baseDir != null) { log.info("Application base directory (from VaadinService) is {}", baseDir.getAbsolutePath()); } else { log.error("Application base directory has not been set"); } return baseDir; } throw new IllegalStateException("There is no current VaadinService"); }
@Override public File applicationBaseDirectory() { if (VaadinService.getCurrent() != null) { File baseDir = VaadinService.getCurrent() .getBaseDirectory(); if (baseDir != null) { log.info("Application base directory (from VaadinService) is {}", baseDir.getAbsolutePath()); } else { log.error("Application base directory has not been set"); } return baseDir; } throw new IllegalStateException("There is no current VaadinService"); }
@Override public File resourcePath(@Nonnull String fileName) { Preconditions.checkNotNull(fileName); File baseDir; if (VaadinService.getCurrent() != null) { baseDir = applicationBaseDirectory(); } else { baseDir = new File("src/main/resources"); } return new File(baseDir, fileName); } }
@Override public File resourcePath(String fileName) { Preconditions.checkNotNull(fileName); File baseDir; if (VaadinService.getCurrent() != null) { baseDir = applicationBaseDirectory(); } else { baseDir = new File("src/main/resources"); } return new File(baseDir, fileName); } }
locations.add(new File(VaadinService.getCurrent().getBaseDirectory(), "/WEB-INF/conf/" + configFile));
addCustomUIPlugins(pluginManager); File baseDir = VaadinService.getCurrent().getBaseDirectory();
router = Optional.ofNullable(VaadinService.getCurrent()) .map(VaadinService::getRouter);
VaadinService.getCurrent().getBaseDirectory().getAbsolutePath());