Java 类com.vaadin.server.VaadinServlet 实例源码

项目:crawling-framework    文件:Application.java   
public static void main(String[] args) {
    int port = Configuration.INSTANCE.getInt("port", 8080);
    Server server = new Server(port);
    ServletContextHandler contextHandler
            = new ServletContextHandler(ServletContextHandler.SESSIONS);
    contextHandler.setContextPath("/");
    ServletHolder sh = new ServletHolder(new VaadinServlet());
    contextHandler.addServlet(sh, "/*");
    contextHandler.setInitParameter("ui", CrawlerAdminUI.class.getCanonicalName());
    contextHandler.setInitParameter("productionMode", String.valueOf(PRODUCTION_MODE));
    server.setHandler(contextHandler);
    try {
        server.start();
        server.join();
    } catch (Exception e) {
        LOG.error("Failed to start application", e);
    }
}
项目:crawling-framework    文件:Application.java   
public static void main(String[] args) {
    int port = Configuration.INSTANCE.getInt("port", 8080);
    Server server = new Server(port);
    ServletContextHandler contextHandler
            = new ServletContextHandler(ServletContextHandler.SESSIONS);
    contextHandler.setContextPath("/");
    ServletHolder sh = new ServletHolder(new VaadinServlet());
    contextHandler.addServlet(sh, "/*");
    contextHandler.setInitParameter("ui", AnalysisUI.class.getCanonicalName());
    contextHandler.setInitParameter("productionMode", String.valueOf(PRODUCTION_MODE));
    server.setHandler(contextHandler);
    try {
        server.start();
        server.join();
    } catch (Exception e) {
        LOG.error("Failed to start application", e);
    }
}
项目:incubator-tamaya-sandbox    文件:TamayaUI.java   
/**
 * The main entry point, use configuration as follows:
 * <pre>
 *     tamaya.server.contextPath: the context path, default=/tamaya
 *     tamaya.server.port: the port, default=8090
 *     tamaya.server.productionMode: vadiin production mode setting, default=false.
 * </pre>
 * @param args the args
 * @throws Exception if startup fails.
 */
public static void main(String[] args) throws Exception {
    Configuration config = ConfigurationProvider.getConfiguration();
    String contextPath = config.getOrDefault("tamaya.server.contextPath", "/tamaya");
    String appBase = ".";
    Tomcat tomcat = new Tomcat();
    tomcat.setPort(Integer.valueOf(config.getOrDefault("tamaya.server.port", Integer.class, 8090) ));

    // Define a web application context.
    Context context = tomcat.addWebapp(contextPath, new File(
            appBase).getAbsolutePath());
    // Add Vadiin servlet
    Wrapper wrapper = tomcat.addServlet(context, "vadiin-servlet",
            VaadinServlet.class.getName());
    wrapper.addInitParameter("ui",
            TamayaUI.class.getName());
    wrapper.addInitParameter("productionMode",config.getOrDefault("tamaya.server.productionMode", String.class,
            "false"));
    wrapper.addInitParameter("asyncSupported", "true");
    context.addServletMapping("/*", "vadiin-servlet");
    // bootstrap.addBundle(new AssetsBundle("/VAADIN", "/VAADIN", null, "vaadin"));
    tomcat.start();
    tomcat.getServer().await();
}
项目:sensorhub    文件:AdminUIModule.java   
@Override
public void start() throws SensorHubException
{
    // reset java util logging config so we don't get annoying atmosphere logs
    LogManager.getLogManager().reset();//.getLogger("org.atmosphere").setLevel(Level.OFF);

    vaadinServlet = new VaadinServlet();
    Map<String, String> initParams = new HashMap<String, String>();
    initParams.put(SERVLET_PARAM_UI_CLASS, AdminUI.class.getCanonicalName());
    initParams.put(SERVLET_PARAM_MODULE_ID, getLocalID());
    if (config.widgetSet != null)
        initParams.put(WIDGETSET, config.widgetSet);
    initParams.put("productionMode", "true");  // set to false to compile theme on-the-fly       
    HttpServer.getInstance().deployServlet(vaadinServlet, initParams, "/admin/*", "/VAADIN/*");
    HttpServer.getInstance().addServletSecurity("/admin/*", "admin");
}
项目:sqlexplorer-vaadin    文件:CommonUiUtils.java   
public static AceEditor createAceEditor() {
    AceEditor editor = new AceEditor();
    editor.setSizeFull();
    ServletContext context = VaadinServlet.getCurrent().getServletContext();
    if (context.getRealPath("/VAADIN/ace") != null) {
        String acePath = context.getContextPath() + "/VAADIN/ace";
        editor.setThemePath(acePath);
        editor.setModePath(acePath);
        editor.setWorkerPath(acePath);
    } else {
        log.warn("Could not find a local version of the ace editor.  " + "You might want to consider installing the ace web artifacts at "
                + context.getRealPath(""));
    }
    editor.setHighlightActiveLine(true);
    editor.setShowPrintMargin(false);
    return editor;
}
项目:vexer    文件:VilleExerStubUI.java   
/**
 * Returns path to directory where the stub should store it files.
 * 
 * @return path to the base-directory of stub-resources
 */
protected String getStubResourceBaseDir() {

    String pathToRes = VaadinServlet.getCurrent().getServletContext()
            .getInitParameter(STUB_RES_PATH_PARAM);

    if (pathToRes == null || pathToRes.equals("")) {
        pathToRes = VaadinServlet.getCurrent().getServletContext()
                .getRealPath("/VILLE/stub");
        // likely deployed as war, use temp-location
        if (pathToRes == null) {
            logger.warning("Placing VILLE-stub-resources-directory under temp");
            pathToRes = System.getProperty("java.io.tmpdir") + "/VILLE/stub";
        }
    }

    logger.info("Used VILLE-stub resource path: " + pathToRes);

    return pathToRes;
}
项目:vexer    文件:VilleExerStubUI.java   
/**
 * Return a list of Locales that will be available in the testing UI.
 * 
 * @return {@link List} of {@link Locale}s
 */
protected List<Locale> getLocalesToTest() {

    String localesStr = VaadinServlet.getCurrent().getServletContext()
            .getInitParameter(LOCALES_TO_TEST_PARAM);

    List<Locale> res = new ArrayList<Locale>();
    if (localesStr != null && !localesStr.equals("")) {
        String[] locales = localesStr.split(";");
        for (String aLocal : locales) {
            if (aLocal.contains("_")) {
                String[] langCountry = aLocal.split("_");
                res.add(new Locale(langCountry[0], langCountry[1]));
            } else {
                res.add(new Locale(aLocal));
            }
        }
    } else {

        res.add(Locale.ENGLISH);
    }
    return res;
}
项目:hypothesis    文件:ProcessUIPresenter.java   
/**
 * Do on test closing
 * 
 * @param event
 */
public void requestClose(@Observes final CloseTestEvent event) {
    log.debug("close requested");
    if (requestBack) {
        log.debug("closing ProcessUI with history back");
        JavaScript javaScript = ui.getPage().getJavaScript();
        javaScript.execute("window.history.back();");
        ui.requestClose();

    } else {
        String path = VaadinServlet.getCurrent().getServletContext().getContextPath();
        ui.getPage().setLocation(path + CLOSE_URL);
        // this is also possible way but not for SWT browser
        // Page.getCurrent().getJavaScript().execute("window.setTimeout(function(){/*window.open('','_self','');*/window.close();},10);")

        log.debug("closing ProcessUI");
        ui.requestClose();
    }
}
项目:holon-vaadin7    文件:AbstractVaadinSpringTest.java   
public TestSpringVaadinServletService(VaadinServlet servlet, WebApplicationContext applicationContext)
        throws ServiceException {
    super(servlet, new DefaultDeploymentConfiguration(TestSpringVaadinServletService.class, new Properties()),
            "");
    this.appContext = applicationContext;
    init();
}
项目:holon-vaadin    文件:AbstractVaadinSpringTest.java   
public TestSpringVaadinServletService(VaadinServlet servlet, WebApplicationContext applicationContext)
        throws ServiceException {
    super(servlet, new DefaultDeploymentConfiguration(TestSpringVaadinServletService.class, new Properties()),
            "");
    this.appContext = applicationContext;
    init();
}
项目:holon-vaadin    文件:HolonVaadinServletAutoConfiguration.java   
@Bean
@ConditionalOnMissingBean
public VaadinServlet vaadinServlet() {
    HolonVaadinServlet servlet = new HolonVaadinServlet();
    configureServlet(servlet);

    LOGGER.debug(() -> "HolonVaadinServlet configured");

    return servlet;
}
项目:awplab-core    文件:VaadinManagerProvider.java   
@Validate
private void start() {
    bootstrapVaadinServlet = new VaadinServlet();
    try {
        webContainer.registerServlet(bootstrapVaadinServlet, new String[]{"/VAADIN/*"}, null, null);
    }
    catch (ServletException ex) {
        logger.error("Exception registering boostrapVaadinServlet!", ex);
    }
    logger.info("VaadinManager started, Registered boostrapVaadinServlet!");

    EventAdminHelper.postEvent(VaadinEventTopics.MANAGER_STARTED);
}
项目:awplab-core    文件:VaadinManagerProvider.java   
@Override
public void registerProvider(VaadinProvider vaadinProvider) throws ServletException, InvalidVaadinProvider {
    if (vaadinProvider.getPath() == null || !vaadinProvider.getPath().startsWith("/") || vaadinProvider.getPath().endsWith("/")) {
        throw new InvalidVaadinProvider("Invalid path, path must not be null, start with a / and end with no /");
    }

    //if (!(vaadinProvider instanceof VaadinServlet)) {
    //    throw new InvalidVaadinProvider("Vaading provider must extend vaadin servlet");
    //}
    if (providers.contains(vaadinProvider)) throw new InvalidVaadinProvider("VaadinProvider already registerd");

    VaadinServlet vaadinServlet = new BaseVaadinServlet(vaadinProvider);

    Dictionary<String, Object> initParams = new Hashtable<String, Object>();
    initParams.put("productionMode", vaadinProvider.productionMode() ? "true" : "false");
    vaadinProvider.heartbeatInterval().ifPresent(integer -> {initParams.put("heartbeatInterval", Integer.toString(integer)); });
    vaadinProvider.closeIdleSessions().ifPresent(close -> {initParams.put("closeIdleSessions", close ? "true" : "false"); });
    vaadinProvider.pushMode().ifPresent(pushMode -> {initParams.put("pushmode", pushMode.toString().toLowerCase());});
    //initParams.put("UIProvider", new VaadinUIProvider(vaadinProvider, vaadinServlet));

    webContainer.registerServlet(vaadinServlet, new String[] { vaadinProvider.getPath() + "/*"}, initParams, 0, true, (vaadinProvider instanceof BasicAuthRequired ? new BasicAuthHttpContext(webContainer.getDefaultSharedHttpContext(), (BasicAuthRequired)vaadinProvider) : webContainer.getDefaultSharedHttpContext()));

    servlets.put(vaadinProvider, vaadinServlet);

    EventAdminHelper.postEvent(VaadinEventTopics.PROVIDER_ADDED, VaadinEventData.VAADIN_PROVIDER, vaadinProvider);


}
项目:hybridbpm    文件:FormEditor.java   
private void compileTheme() {
    try {
        binder.commit();
        ServletContext context = VaadinServlet.getCurrent().getServletContext();
        String fullPath = context.getRealPath("/VAADIN/themes/dashboard");
        String customScssFileName = fullPath + "/custom.scss";
        SassCompiler.writeFile(customScssFileName, module.getModel());

        ProcessBuilder processBuilder = new ProcessBuilder("java", "-cp", "../../../WEB-INF/lib/*", "com.vaadin.sass.SassCompiler", "styles.scss", "styles.css");
        processBuilder.directory(new File(fullPath));
        File error = new File(fullPath, "custom.scss.log");
        processBuilder.redirectErrorStream(true);
        processBuilder.redirectError(Redirect.PIPE);
        Process process = processBuilder.start();
        process.waitFor();

        BufferedReader reader = new BufferedReader(new InputStreamReader(process.getErrorStream()));
        StringBuilder builder = new StringBuilder();
        String line = reader.readLine();
        while (line != null) {
            builder.append(line);
            line = reader.readLine();
        }
        reader.close();
        if (!builder.toString().trim().isEmpty()) {
            throw new Exception(builder.toString());
        }

    } catch (Exception ex) {
        logger.log(Level.SEVERE, ex.getMessage(), ex);
        Notification.show("Error", ex.getMessage(), Notification.Type.ERROR_MESSAGE);
    }
}
项目:hybridbpm    文件:HybridbpmServer.java   
private static void startUndertow() throws ServletException {
    ServletInfo servletInfo = new ServletInfo(VaadinServlet.class.getName(), VaadinServlet.class)
            .setAsyncSupported(true)
            .setLoadOnStartup(1)
            .addInitParam("ui", "com.hybridbpm.ui.HybridbpmUI").addInitParam("widgetset", "com.hybridbpm.ui.HybridbpmWidgetSet")
            .addMapping("/*").addMapping("/VAADIN");

    DeploymentInfo deploymentInfo = deployment()
            .setClassLoader(HybridbpmServer.class.getClassLoader())
            .setContextPath(PATH)
            .setDeploymentName("hybridbpm.war")
            .setDisplayName("HYBRIDBPM")
            .setResourceManager(new ClassPathResourceManager(HybridbpmServer.class.getClassLoader()))
            .addServlets(servletInfo)
            .addServletContextAttribute(WebSocketDeploymentInfo.ATTRIBUTE_NAME, new WebSocketDeploymentInfo());

    DeploymentManager manager = defaultContainer().addDeployment(deploymentInfo);
    manager.deploy();

    PathHandler path = Handlers.path(Handlers.redirect(PATH)).addPrefixPath(PATH, manager.start());

    Undertow.Builder builder = Undertow.builder().addHttpListener(8080, "0.0.0.0").setHandler(path);

    undertow = builder.build();
    undertow.start();
    logger.info("HybridbpmServer UI started");
}
项目:metl    文件:AppUI.java   
public static WebApplicationContext getWebApplicationContext() {
    VaadinServlet servlet = VaadinServlet.getCurrent();
    if (servlet != null) {
    return WebApplicationContextUtils
            .getRequiredWebApplicationContext(servlet.getServletContext());
    } else {
        return null;
    }
}
项目:vexer    文件:VilleExerStubUI.java   
/**
 * Returns the list of {@link ExerciseTypeDescriptor}s describing the exercise-types that will be loaded for testing in the stub.
 * 
 * @return list of {@link ExerciseTypeDescriptor}s to be loaded for testing
 */
protected List<ExerciseTypeDescriptor<?, ?>> getTypesToLoad() {
    {

        Set<Class<?>> potentialClasses;
        List<ExerciseTypeDescriptor<?, ?>> res = new ArrayList<ExerciseTypeDescriptor<?, ?>>();

        String toLoadClasses = VaadinServlet.getCurrent()
                .getServletContext().getInitParameter(TYPES_TO_LOAD_PARAM);
        if (toLoadClasses != null && !toLoadClasses.equals("")) {
            potentialClasses = new HashSet<Class<?>>();

            String[] classes = toLoadClasses.split(";");
            for (String cls : classes) {
                try {
                    Class<?> aCls = Class.forName(cls);
                    potentialClasses.add(aCls);
                } catch (ClassNotFoundException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }

        } else {
            potentialClasses = findPotentialClasses();
        }

        for (Class<?> potentialClass : potentialClasses) {
            ExerciseTypeDescriptor<?, ?> etDesc = parseDescFromCls(potentialClass);
            if (etDesc != null) {
                res.add(etDesc);
            }
        }

        return res;

    }
}
项目:vaadinator    文件:AddressbookExampleUIEx.java   
@Override
protected void init(VaadinRequest request) {
    // for mobile, set yet another theme
    if (VaadinServlet.getCurrent() instanceof TouchKitServlet) {
        setTheme("touchkitexex");
    }
    super.init(request);
}
项目:extacrm    文件:ServiceLocator.java   
/**
 * Ищет подходящий экземпляр для интерфейса службы
 *
 * @param srvType Тип службы
 * @return экземпляр службы
 * @param <TServiceType> a TServiceType object.
 */
public static <TServiceType> TServiceType lookup(final Class<TServiceType> srvType) {

    final VaadinServlet vaadinServlet = VaadinServlet.getCurrent();
    if (vaadinServlet == null) {
        logger.error("Couldn't get current instance of VaadinServlet");
        throw new IllegalStateException("Couldn't get current instance of VaadinServlet");
    }
    final WebApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(vaadinServlet.getServletContext());

    return context.getBean(srvType);
}
项目:extacrm    文件:ServiceLocator.java   
/**
 * Ищет подходящий именованый экземпляр заданного типа
 *
 * @param name    Имя
 * @param srvType Тип
 * @return экземпляр
 * @param <TServiceType> a TServiceType object.
 */
public static <TServiceType> TServiceType lookup(final String name, final Class<TServiceType> srvType) {

    final VaadinServlet vaadinServlet = VaadinServlet.getCurrent();
    if (vaadinServlet == null) {
        logger.error("Couldn't get current instance of VaadinServlet");
        throw new IllegalStateException("Couldn't get current instance of VaadinServlet");
    }
    final WebApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(vaadinServlet.getServletContext());

    return context.getBean(name, srvType);
}
项目:hypothesis    文件:MainPresenterImpl.java   
public MainPresenterImpl() {
    System.out.println("Construct " + getClass().getName());

    Manifest manifest = ServletUtil.getManifest(VaadinServlet.getCurrent().getServletContext());
    Attributes attributes = manifest.getMainAttributes();
    VERSION = attributes.getValue("Version");
    VERSION_SPECIFIC = attributes.getValue("Version-Specific");
    VERSION_ADDITIONAL = attributes.getValue("Version-Additional");
}
项目:VaadinUtils    文件:JasperReportLayout.java   
private void createScheduleButton(String buttonHeight, HorizontalLayout buttonContainer)
{
    scheduleButton = new NativeButton();

    JpaBaseDao<ReportEmailScheduleEntity, Long> dao = JpaBaseDao.getGenericDao(ReportEmailScheduleEntity.class);
    Long count = dao.getCount(ReportEmailScheduleEntity_.JasperReportPropertiesClassName,
            reportProperties.getReportClass().getCanonicalName());

    ScheduleIconBuilder iconBuilder = new ScheduleIconBuilder();

    String baseIconFileName = "Call Calendar_32";
    String path = VaadinServlet.getCurrent().getServletContext().getRealPath("templates/images/seanau/");

    // HACK: scoutmaster stores images in a different directory so if the
    // images isn't found in the above templates directory
    // then search in the /images/seanau director.
    if (path == null || !new File(path).exists())
    {
        path = VaadinServlet.getCurrent().getServletContext().getRealPath("/images/seanau/");
    }
    String targetFileName = baseIconFileName + "-" + count + ".png";
    iconBuilder.buildLogo(count.intValue(), new File(path), baseIconFileName + ".png", targetFileName);

    scheduleButton.setIcon(new ExternalResource("images/seanau/" + targetFileName));
    scheduleButton.setDescription("Schedule");
    scheduleButton.setWidth("50");
    scheduleButton.setHeight(buttonHeight);
    scheduleButton.addClickListener(new ClickEventLogged.ClickListener()
    {

        private static final long serialVersionUID = 7207441556779172217L;

        @Override
        public void clicked(ClickEvent event)
        {
            new JasperReportSchedulerWindow(reportProperties, builder.getReportParameters());
        }
    });
    buttonContainer.addComponent(scheduleButton);
}
项目:touchkit    文件:CacheManifestStatusIndicatorConfTest.java   
public CacheManifestStatusIndicatorConfTest() {
    setDescription("Test for modifying CacheManifestStatusIndicator settings");

    final TextField updateNowMessageTF = new TextField("updateNowMessage");
    updateNowMessageTF
            .setValue("There are updates ready to be installed. Would you like to restart now?");

    final TextField updateCheckIntervalTF = new TextField(
            "updateCheckInterval");
    updateCheckIntervalTF.setValue("1800");

    Button commit = new Button("Commit");
    commit.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            ApplicationCacheSettings applicationCacheSettings = ((TouchKitServlet) VaadinServlet
                    .getCurrent()).getTouchKitSettings()
                    .getApplicationCacheSettings();
            applicationCacheSettings.setUpdateNowMessage(updateNowMessageTF
                    .getValue());
            applicationCacheSettings.setUpdateCheckInterval(Integer
                    .valueOf(updateCheckIntervalTF.getValue()));
        }
    });

    addComponent(updateNowMessageTF);
    addComponent(updateCheckIntervalTF);
    addComponent(commit);
}
项目:fotorest    文件:FotorestUI.java   
@Override
protected void init(VaadinRequest request) {
    setLocale(Locale.US);

    // Injecting beans the old way
    SpringContextHelper helper = new SpringContextHelper(VaadinServlet.getCurrent().getServletContext());
    service = (RestService) helper.getBean("restService");
    content.setMargin(true);

    initLayout();
    initFotoList();
}
项目:esup-ecandidat    文件:AppServletJMeter.java   
public JMeterService(VaadinServlet servlet,
        DeploymentConfiguration deploymentConfiguration)
        throws ServiceException {
    super(servlet, deploymentConfiguration,null);
}
项目:vaadin-vertx-samples    文件:VertxVaadinService.java   
@Override
public String getConfiguredWidgetset(VaadinRequest request) {
    return getDeploymentConfiguration().getWidgetset(VaadinServlet.DEFAULT_WIDGETSET);
}
项目:awplab-core    文件:VaadinUIProvider.java   
public VaadinUIProvider(VaadinProvider vaadinProvider, VaadinServlet vaadinServlet) {
    this.vaadinProvider = vaadinProvider;
    this.vaadinServlet = vaadinServlet;
}
项目:metasfresh-procurement-webui    文件:Application.java   
@Bean
public VaadinServlet vaadinServlet()
{
    return new SpringAwareTouchKitServlet();
}
项目:cuba    文件:App.java   
/**
 * Called when <em>the first</em> UI of the session is initialized.
 */
protected void init(Locale requestLocale) {
    VaadinSession vSession = VaadinSession.getCurrent();
    vSession.setAttribute(App.class, this);

    vSession.setLocale(messageTools.getDefaultLocale());

    // set root error handler for all session
    vSession.setErrorHandler(event -> {
        try {
            getExceptionHandlers().handle(event);
            getAppLog().log(event);
        } catch (Throwable e) {
            //noinspection ThrowableResultOfMethodCallIgnored
            log.error("Error handling exception\nOriginal exception:\n{}\nException in handlers:\n{}",
                    ExceptionUtils.getStackTrace(event.getThrowable()), ExceptionUtils.getStackTrace(e)
            );
        }
    });

    appLog = new AppLog();

    connection = createConnection();
    exceptionHandlers = new ExceptionHandlers(this);
    cookies = new AppCookies();

    themeConstants = loadTheme();

    VaadinServlet vaadinServlet = VaadinServlet.getCurrent();
    ServletContext sc = vaadinServlet.getServletContext();
    String resourcesTimestamp = sc.getInitParameter("webResourcesTs");
    if (StringUtils.isNotEmpty(resourcesTimestamp)) {
        this.webResourceTimestamp = resourcesTimestamp;
    }

    log.debug("Initializing application");

    // get default locale from config
    Locale targetLocale = resolveLocale(requestLocale);
    setLocale(targetLocale);
}
项目:sqlexplorer-vaadin    文件:AbstractSpringUI.java   
public WebApplicationContext getWebApplicationContext() {
    return WebApplicationContextUtils.getRequiredWebApplicationContext(VaadinServlet
            .getCurrent().getServletContext());
}
项目:vexer    文件:UILanguageGiver.java   
/**
 * Finds all the translation files from predefined path using the servlet-context methods for loading the .trl files also from the exercise-type jars
 * (and other ville-jars containing .trl files)
 * 
 * @throws IOException
 *             if there is an i/o-error
 */
public void readFiles() throws IOException {
    dictsByLang.clear();

    Set<String> matches = VaadinServlet.getCurrent()
            .getServletContext()
            .getResourcePaths("/VILLE/language/extensions/");

    for (String aMatch : matches) {
        if (aMatch.endsWith(translationFileSuffix)) {

            // strip path
            String fname = aMatch;
            if (fname.contains("/")) {
                // known to end with 'translationFileSuffix' so should
                // not be out-of-index
                fname = fname.substring(fname.lastIndexOf("/") + 1);
            }
            String currPrefix = fname.substring(0,
                    fname.length() - translationFileSuffix.length())
                    .toUpperCase();

            Map<String, Map<String, String>> newTranslations = TranslationFileParser
                    .parseTranslationFile(currPrefix,
                            (readFile(VaadinServlet.getCurrent()
                                    .getServletContext()
                                    .getResourceAsStream(aMatch))));

            for (Entry<String, Map<String, String>> addToLang : newTranslations
                    .entrySet()) {

                Map<String, String> translationsInLang = dictsByLang
                        .get(addToLang.getKey());
                if (translationsInLang == null) {
                    translationsInLang = new HashMap<String, String>();
                    dictsByLang.put(addToLang.getKey(),
                            translationsInLang);
                }

                for (Entry<String, String> newTranslation : addToLang
                        .getValue().entrySet()) {
                    // this would require having two translation files
                    // with same name
                    if (translationsInLang.put(newTranslation.getKey(),
                            newTranslation.getValue()) != null) {
                        logger.warning("Overrid entry for key: "
                                + newTranslation.getKey()
                                + ". This probably means that you have "
                                + "included two .trl files with same namespace (=file-name)");
                    }
                }

            }

        } else {
            logger.warning("Non-trl resource-file ( " + aMatch
                    + " ) contained in translation file path!");
        }
    }

}
项目:vaadin4spring    文件:ExtensionsAutoConfiguration.java   
/**
 * We will register our own Vaadin Servlet.
 */
@Bean
@ConditionalOnMissingBean
VaadinServlet vaadinServlet() {
    return new Vaadin4SpringServlet();
}
项目:awplab-core    文件:VaadinProvider.java   
default void servletInitialized(VaadinServlet vaadinServlet) {

    }
项目:vaadin4spring    文件:Vaadin4SpringServletService.java   
/**
 * Create a servlet service instance that allows the use of a custom service
 * URL.
 *
 * @param servlet
 * @param deploymentConfiguration
 * @param serviceUrl              custom service URL to use (relative to context path, starting
 *                                with a slash) or null for default
 * @throws ServiceException
 */
public Vaadin4SpringServletService(VaadinServlet servlet, DeploymentConfiguration deploymentConfiguration, String serviceUrl) throws ServiceException {
    super(servlet, deploymentConfiguration, serviceUrl);
    logger.info("Using custom Vaadin4Spring servlet service");
    applicationContext = WebApplicationContextUtils.getWebApplicationContext(servlet.getServletContext());
}