Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

where to find HttpRequest class

 
Yan Zhou
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Sorry if this question is too trivial, but I do not seee HttpRequest or HttpResponse class in JDK.

What if, in Java, I want to construct a request and post it to a URL?
Thanks.
Yan
 
Catalin Merfu
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
These classes are not in the JDK (J2SE) but in J2EE.
The packages you are interested in:

javax.servlet
javax.servlet.http


Go to http://java.sun.com to download the j2ee installation package and the documentation and look for web development tutorials.

If you just need the classes and use Tomcat look for servlet.jar in the installation dir.
 
Yan Zhou
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Request in Servlet package is for server side, what I am looking for is for client.

Say, I want to create a connection to a URL, construct a request object, sepcifying method being POST, add body, etc., where do I find such a HttpRequest class?

Thanks.
Yan
 
Joe Ess
Bartender
Posts: 9362
11
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
java.net.URL, java.net.URLConnection and java.net.HttpURLConnection in order of increasing specialization.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!