• 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
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

GET Request from inside a Servlet

 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi to all, I'm trying to make a GET HTTP request to a remote URL from inside a Servlet. Which library should I use? I would like to avoid using URLFetch because I found it's really low-level. Can I use a library where I can have a HttpRequest object or something like that where I can add parameters like object.addParameter(name, value)? I don't understand why a library like that is not available. I just want to be sure that doesn't exist other better libraries before start using URLFetch.

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

You can use the URLConnection class in the package java.net.* to make a GET/POST request to a remote URL.

Hope this helps.
 
Marco Zanini
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, I was just asking if there's something more high-level.
I have to extract from the response some parameters and I want to avoid parsing a String manually.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The Apache Software Foundation project named HttpComponents has taken over the HTTPClient toolkit. A very complete and well debugged set of tools and of course open source.

Bill
 
Marco Zanini
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks that's what I was looking for!

reply
    Bookmark Topic Watch Topic
  • New Topic