package com.blogspot.diegopacheco.groovy.rest.server import com.sun.grizzly.http.SelectorThread; import com.sun.grizzly.tcp.Adapter; import com.sun.jersey.api.container.ContainerFactory; import com.sun.jersey.api.container.grizzly.GrizzlyServerFactory; import com.blogspot.diegopacheco.groovy.rest.server.GroovyPojo; import javax.ws.rs.core.UriBuilder; import java.io.IOException; import java.net.URI; import java.util.HashMap; import java.util.Map; /** * * Server Groovy que utiliza o Grizzly para levantar um endpoint WS-REST * feito em Groovy. * * @autor Diego Pacheco * @since 05/01/2009 * @version 1.0 * **/ adapter = ContainerFactory.createContainer(Adapter.class,GroovyPojo.class) baseUri = UriBuilder.fromUri("http://localhost/").port(10101).build() server = GrizzlyServerFactory.create(baseUri, adapter) System.out.println("Jersey WS-REST startado... OK"); System.out.println("Tente digitar: http://127.0.0.1:10101/groovy-pojo no seu browser") System.in.read() server.stopEndpoint()