W3C home > Mailing lists > Public > www-html@w3.org > September 1998

Re: Invoking WebServer Servlets from JAVA Application - Solution

From: Wayne Clark <wclark@holstein.com>
Date: Thu, 17 Sep 1998 13:02:10 -0400
Message-Id: <36014092.4CF22027@holstein.com>
To: www-html@w3.org
AnyOne,

    Sorry, I found the answer.
...

 URL myURL=null;
 URLConnection myCon=null;
 try{
    myURL = new
URL("http://pcx4183.holstein.com:8080/services?action=testComm");
 myCon = myURL.openConnection();
 }
    catch (MalformedURLException mfURLe) {
 System.out.println(" MalformedURLException ");
 }
 catch ( IOException ioE ) {
   System.out.println("  IOException");
 }

    try {
    int c;
  System.out.println("=== Content +++");
  InputStream input = myCon.getInputStream();
  while (((c = input.read()) != -1)) {
   System.out.print((char) c);
  }
  input.close();
 }
 catch ( IOException ioE2 ) {
   System.out.println("  IOException2");
 }

...

I just needed to do a GET by doing myCon.getInputStream().  That told
the webserver to do something.


Wayne
Received on Thursday, 17 September 1998 12:59:42 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 27 March 2012 18:15:37 GMT