Skip to content


JSR-311: Java API for RESTful Web Services

Eu estou atualmente implementando alguns web services Restful, e estou avaliando opções para alguns pedaços do desenvolvimento. Eu já sabia que existia uma JSR para web services REST, mas ainda não tinha lido a mesma.Agora há pouco li a JSR-311, que definirá padrões de implementação Java para uma API Rest, do lado do servidor. A parte de implementação de clientes será tratada em outra(s) JSR(s) .

Esta JSR é bastante interessante, e já pude ver nela o tratamento de coisas muito úteis. De principal destaque para mim está a abordagem de mapeamento de URIs em recursos e métodos e a questão do mapeamento de classes Java para dados com diversos content-types.

Em relação às URIs, há a definição de regras para mapear URIs em classes e métodos, instanciando as classes necessárias e invocando os métodos adequados. Suponha por exemplo uma requisicao HTTP PUT na URI /usuario/16728/produto/228/configuracao/. Em um protocolo definido por mim, isto representaria uma atualização nas configurações do Produto 228 para o Usuário 16728. Um ser humano consegue entender isso sem tantos problemas, mas uma implementação manual destes mapeamentos e o parsing dos parâmetros podem ser coisas bem trabalhosas. A JSR 311 utiliza várias annotations para conseguir definir o encadeamento de classes e métodos a partir da URI utilizada, e isto faz com que você consiga desenvolver em Java normalmente e ter as suas classes instanciadas e invocadas com URIs tão flexíveis quanto você queira. Muito bom ter isso como recurso, pois implementar na mão é bem trabalhoso.

Outra coisa muito interessante é a maneira de mapear classes Java para diversos content-types. Isso é algo fundamental para uma implementação Restful com bastante flexibilidade E possivelmente alta performance. A idéia por trás disso é que o servidor recebe uma requisição de um cliente e verifica quais são os content-types que o cliente aceita. Com base nestas informações, o servidor escolhe a forma que irá utilizar para transmitir os dados.

Suponha por exemplo que uma aplicação PHP está se comunicando com seu servidor, e ele lhe informa que aceita os content-types text/plain, text/xml e application/json. O servidor pode escolher qual formato utilizar para o envio e possivelmente o envio com formato json facilita bastante a aplicação PHP. Este mesmo servidor pode receber requisições de uma outra aplicação Java, que preferencialmente receberá do seu servidor um stream binário, que terá a melhor performance de todas as opções.

O uso desta abordagem dos mapeamentos em content-types permite que sua aplicação tenha ao mesmo tempo alta interoperabilidade e alta performance. Você conseguirá se comunicar com várias plataformas e aplicações diferentes, e continuará tendo a opção de alta performance, caso seja uma aplicação da mesma plataforma. Você não consegue isso com web services WS-*. Eles não têm tamanha flexibilidade.

O meu próximo passo agora será analisar com detalhes o Jersey, a implementação de referência desta JSR. A especificação em si ainda está um tanto crua, pois ainda é um early draft. Já pude ver vários pontos interessantes, mas a definição ainda está sujeita a muitas modificações. Vou avaliar agora o que o Jersey já oferece e torcer para que ele já tenha componentes fáceis de usar e flexíveis. A proposta dele é excelente, vamos ver se a implementação consegue oferecer estes recursos sem amarrar muito as decisões de projeto.

Posted in java, open source, posts em português.

Tagged with , , , , , , .


One Response

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

Continuing the Discussion

  1. Jersey meets Abdera « Blog do Bruno Pereira linked to this post on 06/02/2008

    [...] Publishing Protocol. Já o Jersey é a implementação de referência da JSR-311, que mencionei num post recente aqui no [...]



Some HTML is OK

or, reply to this post via trackback.



  • Buy Cheap xanax recreational use Now The Largest Internet Pharmacy. Best Online.
  • Buy Cheapest insomnia medication prescription Online Drugs, Health And Beauty. Best Internet.
  • Buy Cheapest drugs online Now Low Prices. Discount Pharmacy Online.
  • Buy Cheap pharmacies and prescriptions for pain meds Online No Prescription Needed. Best Prices.
  • Buy Cheapest buy depo medrol Online Best Prices. Internet Prices For buy depo medrol!
  • Buy Cheapest names of prescription pain medications Now Best Drugstore. Cheap Online Pharmacy.
  • Buy Cheapest cialis profestional Online Online Medical Shop. Pharmacy Store.
  • Buy Cheap buy cialis cialas Online Best Drugstore. Online Medical Shop.
  • Buy Cheap health med Now 100% Satisfaction Guaranteed. Pharmacy Store.
  • Buy Cheap on line pharmacies Online Online Prices For on line pharmacies! Best Prices.
  • Buy Cheap consumer proven weight loss medication Online Discount Online Pharmacy. Best Internet.
  • Buy Cheap drugs to treat depression Online Special Prices For drugs to treat depression! Best Online.
  • Buy Cheap medicin depression buy Online 24/Internet)(safe Pharmacy. Best Prices.
  • Buy Cheapest antidepressant purchase france Now Pharmacy At The Best Price! Best Online.
  • alprazolam overdose Online Without Prescription Free Viagra Pills! Best Prices.
  • Buy Cheapest cialis free trials Online Best Internet. WorldWide Shipping.
  • Buy Cheapest belly fat diet pill Online Best Online. Online Prices For belly fat diet pill!
  • Buy Cheapest prescription drugs on internet Online Discount Pharmacy Online. Best Online.
  • Buy Cheapest cheap overseas pharmacies Now Pharmacy At The Best Price! Best Online.
  • Buy ambien purchase Without Prescription Doctor. Pharmacy Store. Low Prices.
  • Buy Cheap spain farmacia levitra Online Online Medical Shop. Cheap Online Pharmacy.
  • Buy Cheapest what is viagra super active Now Top Online Pharmacy. Cheap Pharmacy Online.
  • Buy Cheap overdose of xanax Online Online Medical Shop. Pharmacy Store.
  • Buy Cheap impotence drugs Online Best Online. Internet Prices For impotence drugs!
  • Buy Cheap buy narcotic pain relievers Now Discount Online Pharmacy. WorldWide Shipping.
  • Buy Cheapest phentermine online without doctor orders Now Pharmacy Store. Buy Medications Online.
  • Buy Cheapest generic name viagra Now Pharmacy At The Best Price! Pharmacy Store.
  • Buy Cheapest cheap priced valium Online Guaranteed Shipping. Pharmacy Store.
  • Buy Cheapest buy sleep aids on line Online Best Prices. Discount Online Pharmacy.
  • Buy Cheap viagra drug interactions Online Guaranteed Shipping. WorldWide Shipping.
  • Buy Cheap cheap sarafem Now The Largest Internet Pharmacy. Best Online.
  • Buy Cheap phentermine 30mg Now Cheap Meds Without Prescription. Best Online.
  • Buy Cheap valium dosage Now Guaranteed Shipping. Online Prices For valium dosage!
  • Buy Cheap pain pill withdrawals Online No Prescription Needed. Best Online.
  • Buy Cheap cialis for erection Now Special Prices For cialis for erection! Best Internet.
  • Buy Cheap weight loss doctor online Now Bonus Pills And Reorder Discounts! Low Prices.
  • Buy Cheapest levitra website Online Guaranteed Shipping. Pharmacy Store.
  • Buy Cheap free samples cialis Online Best Internet. Cheap Prescription Drugs.
  • Buy Cheapest maximum fat loss Online WorldWide Shipping. Pharmacy Store.
  • Buy Cheap tadalafil jelly Online Discount Online Pharmacy. Best Prices.
  • how to buy impotence medication Online Without Prescription Best Drugstore. Low Prices.
  • Buy Cheap prescription weight loss meds online Now Guaranteed Shipping. Top Online Pharmacy.
  • Buy Cheapest cheap femara Online Pharmacy Store. No Prescription Needed.
  • Buy Cheap viagra size Online Best Online. Top Online Pharmacy Supplier.
  • Buy Cheap vardenafil hcl Online Pharmacy At The Best Price! Best Drugstore.
  • Buy Cheapest prescription for chlamydia Now Free Viagra Pills! Cheap Pharmacy Online.
  • Buy Cheapest cialis flagstaff Online Free Viagra Pills! Pharmacy Store.
  • Buy Cheapest valium generic Online Guaranteed Shipping. Best Online.
  • Buy Cheapest cheap diet pills online Now Best Online. Online Prices For cheap diet pills online!
  • Buy Cheapest weight loss medicine buy online Now We Can Offer You Visit Our Online Pharmacy.
  • Buy Cheap curing impotence Online Order Cheap Meds Without Rx. Best Online.
  • Buy Cheapest stronger pain killer Now Free Viagra Pills! No Prescription Needed.
  • Buying Cheap india pharmacy. Offshore Rx, Good Prices. Guaranteed Shipping.
  • Buy Cheapest order ampicillin Now Internet Prices For order ampicillin! Best Drugstore.
  • Buy order quality cialis Online Without Prescription. Best Online. Low Prices.
  • Buy Cheap accutane before after Now No Prescription Needed For Drugs. Best Prices.
  • Buy Cheapest side effects of ambien 10 mg Online Cheap Pharmacy Online. Low Prices.
  • Buy Cheapest original cialis Now No Prescription Needed. Free Viagra Pills!
  • Buy Cheapest xanax 2 mg no prescription Now Top Online Pharmacy. WorldWide Shipping.
  • Buy does zyban work Online Without Prescription. Pharmacy Store. Low Prices.
  • Buy Cheapest viagra alcohol Now Special Prices For viagra alcohol! Best Drugstore.
  • Buy Cheapest lexapro for anxiety Online 24/Online Pharmacy. Low Prices.
  • Buy Cheapest viagra for recreational use Now Buy Medications Online. WorldWide Shipping.
  • Buy Cheapest diazepam us pharmacy Online Drugs, Health And Beauty. Low Prices.
  • Buy Cheap how to take viagra Now 24/Online Pharmacy. WorldWide Shipping.
  • Buy Cheapest viagra canada satisfaction guarantee Online Drugs, Health And Beauty. Best Internet.
  • Buy Cheapest mexican cialis Online Drugs, Health And Beauty. Best Internet.
  • Buy Cheapest drug ambien Now Cheap Pharmacy Online. WorldWide Shipping.
  • Buy Cheapest prescribed weight loss medication Now Free Viagra Pills! Cheap Pharmacy Online.
  • Buy Cheap best price for cialis Online Internet Prices For best price for cialis! Low Prices.
  • Buy Cheapest levitra pill size Online Low Prices. Buy Medications Online.
  • Buy cvs drug stores Without Prescription Doctor. Low Prices. Best Internet.
  • Buy Cheap promethazine tablets Now Best Online. Safe And Secure Payment System.
  • Buy Cheap online consultation xanax Online Pharmacy Store. Top Online Pharmacy.
  • Buy Cheap lorazepam withdrawal symptoms Online Best Prices. Drugs, Health And Beauty.
  • Buy Cheapest ultram ultracet Online No Prescription Needed. Low Prices.
  • Buy Cheapest fast weight loss Now Best Online. 100% Satisfaction Guaranteed.
  • Buy Cheapest drugs for depression Now Best Internet. Buy Medications Online.
  • Buy Cheapest valium recreational Online Best Online. Online Prices For valium recreational!
  • Buy Cheapest cialis low dose Now Buy Medications Online. Free Viagra Pills!
  • Buy Cheapest otc treatment for scabies Now WorldWide Shipping. Online Medical Shop.
  • Buy Cheapest diazepam mylan Now Cheap Pharmacy Online. Best Drugstore.
  • Buy Cheap cheap phentermine 37.5 Now The Largest Internet Pharmacy. Best Drugstore.
  • Buy Cheapest pain pills online thailand Online Best Drugstore. Cheap Pharmacy Online.
  • Buy Cheapest prescription drug store online Online Best Internet. Discount Pharmacy Online.
  • Buy Cheap over the counter weight loss drugs Now WorldWide Shipping. Cheap Online Pharmacy.
  • Buy Cheap klonopin effects Now Top Online Pharmacy Supplier. Low Prices.
  • Buy Cheapest erectile dysfunction syndrome drugs Online Best Online. Cheap Prescription Drugs.
  • Buy Cheapest buy ambien online without prescription Online Buy %items% Online Without Prescription.
  • Buy Cheapest viagra online overnight delivery Online Best Drugstore. Online Medical Shop.
  • Buy Cheap bayer levitra cheapest price online pharmacy Now Special Prices For bayer levitra cheapest price online pharmacy! Best Online.
  • Buy Cheapest indian tadalafil Now Best Prices. Cheap Prescription Drugs.
  • Buy Cheapest accutane before after Now Best Online. Pharmacy At The Best Price!
  • Buy Cheapest reliable online pharmacy Now Pharmacy At The Best Price! Best Online.
  • Buy Cheapest finasteride tablets Online Cheap Pharmacy Online. Low Prices.
  • Buy Cheap list pain meds Online Top Online Pharmacy. WorldWide Shipping.
  • Buy Cheap tramadol medicine online Online Internet Prices For tramadol medicine online! Best Internet.
  • Buy Cheapest cialis coupons Online Best Internet. Cheap Prescription Drugs.
  • Buy Cheapest cialis professional cheap Now Cheap Prescription Drugs. Best Drugstore.
  • Buy Cheapest online canada pharmacy Online Free Viagra Pills! Best Drugstore.