• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Consuming REST service using JDK API

 
Ranch Hand
Posts: 255
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have created REST WS (producer) using jersey, to consume the REST can i use JDK net package like URL or URLHttpConnection to consume the REST WS rather than creating the REST client API to consume it? So that irrespective of the REST implementer the client will always use the same JDK API to consume the REST WS. Please clarify.

Thanks.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, the classes built into the JRE are sufficient. However, clients may wish to use a library like Apache HttpClient instead.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Note that since REST is an architectural style for addressing resources rather than a messaging API, I don't think it possible to come up with a universal client.

A simple GET request could return any resource from an XML document to an encrypted image. Just for a start, consider all the resource types a web browser might GET for a single page.

Then we get into POST, PUT, DELETE, etc etc. - in any case, the JDK will be sufficient for generating the request, but handling the resource returned may require a specialized library.

Bill

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic