All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.safehaus.jettyjam.vaadin.VaadinModule Maven / Gradle / Ivy

Go to download

An embedded Jetty, Jackson, Jersey based REST application with Vaadin UI example.

There is a newer version: 2.1.5
Show newest version
package org.safehaus.jettyjam.vaadin;


import java.util.HashMap;
import java.util.Map;

import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
import com.sun.jersey.guice.JerseyServletModule;
import com.sun.jersey.guice.spi.container.servlet.GuiceContainer;


public class VaadinModule extends JerseyServletModule {
    public static final String PACKAGES_KEY = "com.sun.jersey.config.property.packages";


    protected void configureServlets() {
        // Hook Jersey into Guice Servlet
        bind( GuiceContainer.class );

        serve( "/VAADIN/*" ).with( UIServlet.class );

        // Hook Jackson into Jersey as the POJO <-> JSON mapper
        bind( JacksonJsonProvider.class ).asEagerSingleton();

        bind( FooResource.class ).asEagerSingleton();
        bind( UploadResource.class ).asEagerSingleton();

        Map params = new HashMap();
        params.put( PACKAGES_KEY, getClass().getPackage().toString() );
        serve( "/*" ).with( GuiceContainer.class, params );
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy