隨筆-200  評論-148  文章-15  trackbacks-0
          /**
          ?*
          ?*/
          package org;

          import java.io.BufferedReader;
          import java.io.FileInputStream;
          import java.io.FileNotFoundException;
          import java.io.IOException;
          import java.io.InputStream;
          import java.io.InputStreamReader;
          import java.net.HttpURLConnection;
          import java.net.MalformedURLException;
          import java.net.URL;

          import javax.servlet.http.HttpServletResponse;

          /**
          ?* @author myth
          ?*
          ?*/
          public class Test {

          ?? ?/**
          ?? ? * @param args
          ?? ? */
          ?? ?public static void main(String[] args) {

          ?? ??? ?InputStream in;
          ?? ??? ?String s = "";
          ?? ??? ?String sCurrentLine = null;
          ?? ??? ?try {
          ?? ??? ??? ?//URL url = new URL("http://192.168.1.41:8080/lcws/tools/posobserver.jsp");
          ?? ??? ??? ?URL url = new URL("http://127.0.0.1:8080/Test/test.jsp");
          ?? ??? ??? ?HttpURLConnection cnn = (HttpURLConnection) url.openConnection();
          ?? ??? ??? ?cnn.connect();
          ?? ??? ??? ?in = cnn.getInputStream();
          ?? ??? ??? ?BufferedReader buffer = new BufferedReader(new InputStreamReader(in));
          ?? ??? ??? ?while ((sCurrentLine = buffer.readLine()) != null) {
          ?? ??? ??? ??? ?s += sCurrentLine;
          ?? ??? ??? ?}
          ?? ??? ??? ?cnn.disconnect();
          ?? ??? ?} catch (MalformedURLException e) {
          ?? ??? ??? ?// TODO Auto-generated catch block
          ?? ??? ??? ?e.printStackTrace();
          ?? ??? ?} catch (IOException e) {
          ?? ??? ??? ?// TODO Auto-generated catch block
          ?? ??? ??? ?e.printStackTrace();
          ?? ??? ?}

          ?? ?}

          }

          posted on 2007-11-08 08:33 無聲 閱讀(467) 評論(0)  編輯  收藏 所屬分類: 職場生活
          主站蜘蛛池模板: 芜湖县| 山东省| 平度市| 嘉定区| 湘潭县| 海淀区| 翁牛特旗| 邵武市| 汉源县| 格尔木市| 赣州市| 扶沟县| 新化县| 柘城县| 威海市| 潍坊市| 启东市| 栖霞市| 临清市| 阳信县| 浦江县| 河东区| 萨迦县| 永安市| 大石桥市| 阿瓦提县| 武隆县| 辽阳县| 潮安县| 普兰店市| 江达县| 无棣县| 桐梓县| 沧源| 大田县| 秭归县| 彭山县| 昂仁县| 社会| 南开区| 繁峙县|