org.safehaus.jettyjam.vaadin.VaadinModule Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jettyjam-vaadin Show documentation
Show all versions of jettyjam-vaadin Show documentation
An embedded Jetty, Jackson, Jersey based REST application with Vaadin UI
example.
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