47. Expressões regulares nas URIs @Path("/servico) public class MeuServico { @GET @Path("{var:.*}/algo") public String get() {...} GET /servico/algo GET /servico/antes/algo GET /servico/no/meio/de/algo
50. REST Assincrono / COMET import org.jboss.resteasy.annotations.Suspend; import org.jboss.resteasy.spi.AsynchronousResponse; @ Path ( "/" ) public class SimpleResource { @ GET @ Path ( "basic" ) @ Produces ( "text/plain" ) public void getBasic( final @Suspend (10000) AsynchronousResponse response) throws Exception { Thread t = new Thread() { @Override public void run() { try { Response jaxrs = Response .ok( "basic" ).type( MediaType .TEXT_PLAIN).build(); response.setResponse(jaxrs); } catch (Exception e) { e.printStackTrace(); } } }; t.start(); } }
51. Api JavaScript @ Path ( "orders" ) public interface Orders { @ Path ( "{id}" ) @ GET public String getOrder( @ PathParam( "id" ) String id) { return "Hello " +id; } } // JavaScript var order = Orders.getOrder({id: 23}); // Uso do Objeto REST // Change the base URL used by the API: REST.apiURL = "http://api.service.com" ; // log everything in a div element REST.log = function (text ) { jQuery( "#log-div" ).append( text ); };
53. REST é um ótimo modelo de integração, quanto empregado de forma simples e sem burocracia, melhor ainda. Você ainda pode precisar de SOAP,WSDLs, ou seja: WS Tradicionais, mas REST é uma ótima alternativa