File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

GET Request from inside a Servlet

 
Marco Zanini
Ranch Hand
Posts: 43
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
Cole Terry
Ranch Hand
Posts: 45
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13045
6
  • 1
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks that's what I was looking for!

 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic