protected void setupPushConnectionFactory( PushConfiguration pushConfiguration, BootstrapContext context) { VaadinService service = context.getSession().getService(); Iterator<PushConnectionFactory> iter = ServiceLoader .load(PushConnectionFactory.class, service.getClassLoader()) .iterator(); if (iter.hasNext()) { pushConfiguration.setPushConnectionFactory(iter.next()); if (iter.hasNext()) { throw new BootstrapException( "Multiple " + PushConnectionFactory.class.getName() + " implementations found"); } } }
private static String getBootstrapJS(JsonValue initialUIDL, BootstrapContext context) { boolean productionMode = context.getSession().getConfiguration() .isProductionMode(); String result = getBootstrapJS();
private static void setupPwa(Document document, BootstrapContext context) { VaadinService vaadinService = context.getSession().getService(); if (vaadinService == null) { return;
.getPageConfigurationAnnotation(Push.class); DeploymentConfiguration deploymentConfiguration = context.getSession() .getService().getDeploymentConfiguration(); PushMode pushMode = push.map(Push::value)
context.getRequest(), context.getSession(), context.getResponse(), document, context.getUI(), context.getUriResolver()); context.getSession().getService().modifyBootstrapPage(response);
private static void appendWebComponentsPolyfills(Element head, BootstrapContext context) { VaadinSession session = context.getSession(); DeploymentConfiguration config = session.getConfiguration();
private static InitialPageSettings createInitialPageSettingsObject( BootstrapHandler.BootstrapContext context) { UI ui = context.getUI(); VaadinRequest request = context.getRequest(); WebBrowser browser = context.getSession().getBrowser(); String pathInfo = request.getPathInfo(); if (pathInfo == null) { pathInfo = ""; } else { assert pathInfo.startsWith("/"); pathInfo = pathInfo.substring(1); } Router router = ui.getRouter(); NavigationEvent navigationEvent = new NavigationEvent(router, new Location(pathInfo, QueryParameters.full(request.getParameterMap())), ui, NavigationTrigger.PAGE_LOAD); List<HasElement> components = ui.getChildren() .map(component -> (HasElement) component) .collect(Collectors.toList()); AfterNavigationEvent afterNavigationEvent = new AfterNavigationEvent( new LocationChangeEvent(navigationEvent.getSource(), navigationEvent.getUI(), navigationEvent.getTrigger(), navigationEvent.getLocation(), components)); return new InitialPageSettings(request, ui, afterNavigationEvent, browser); }
private static String getClientEngineUrl(BootstrapContext context) { // use nocache version of client engine if it // has been compiled by SDM or eclipse // In production mode, this should really be loaded by the static block // so emit a warning if we get here (tests will always get here) final boolean productionMode = context.getSession().getConfiguration() .isProductionMode(); boolean resolveNow = !productionMode || getClientEngine() == null; if (resolveNow && ClientResourcesUtils.getResource( "/META-INF/resources/" + CLIENT_ENGINE_NOCACHE_FILE) != null) { return context.getUriResolver().resolveVaadinUri( "context://" + CLIENT_ENGINE_NOCACHE_FILE); } if (getClientEngine() == null) { throw new BootstrapException( "Client engine file name has not been resolved during initialization"); } return context.getUriResolver() .resolveVaadinUri("context://" + getClientEngine()); }
/** * Gets the application id. * * The application id is defined by * {@link VaadinService#getMainDivId(VaadinSession, VaadinRequest)} * * @return the application id */ public String getAppId() { if (appId == null) { appId = getRequest().getService().getMainDivId(getSession(), getRequest()); } return appId; }
private static void inlineEs6Collections(Element head, BootstrapContext context) { if (!context.getSession().getBrowser().isEs6Supported()) { head.appendChild(createInlineJavaScriptElement(ES6_COLLECTIONS)); } }
protected static JsonObject getApplicationParameters( BootstrapContext context) { JsonObject appConfig = getApplicationParameters(context.getRequest(), context.getSession()); appConfig.put(ApplicationConstants.UI_ID_PARAMETER, context.getUI().getUIId()); return appConfig; }