PDA

View Full Version : Newb Java Question: HttpRequest


J-G
07-12-2007, 04:07 AM
Hi,

Probably really stupid question, but.. How to use HttpRequest in Java applet? It just says
"Cannot Find Symbol.
Symbol = method httpRequest();"
When I write "httpRequest();"

I probably just need to add some reference or something, but I got no idea what and from where I should add.

Thanks!

ess
07-12-2007, 10:56 AM
If you are creating an Applet instance, I think you need to use the URL class to establish a connection and read data using a stream of some kind...depending on what the data represents obviously (you could encrypt it for example). There might be other ways to establish a connection, but this the only way I know of personally...and if there is another solution, I would very much like to know about it too ;)

The documentation of the URL class can be found here
http://java.sun.com/j2se/1.4.2/docs/api/java/net/URL.html

The following, is a tutorial from Sun Microsystems that demonstrate how to read and write to a URL connection
http://java.sun.com/docs/books/tutorial/networking/urls/readingWriting.html

Hope that helps.

Cheers,
Ess

J-G
07-12-2007, 02:45 PM
If you are creating an Applet instance, I think you need to use the URL class to establish a connection and read data using a stream of some kind...depending on what the data represents obviously (you could encrypt it for example). There might be other ways to establish a connection, but this the only way I know of personally...and if there is another solution, I would very much like to know about it too ;)

The documentation of the URL class can be found here
http://java.sun.com/j2se/1.4.2/docs/api/java/net/URL.html

The following, is a tutorial from Sun Microsystems that demonstrate how to read and write to a URL connection
http://java.sun.com/docs/books/tutorial/networking/urls/readingWriting.html

Hope that helps.

Cheers,
Ess

Thanks, I will try :)
EDIT: THANKS! works just like I needed.. :)