隨筆 - 6  文章 - 129  trackbacks - 0
          <2025年6月>
          25262728293031
          1234567
          891011121314
          15161718192021
          22232425262728
          293012345

          常用鏈接

          留言簿(14)

          隨筆檔案(6)

          文章分類(467)

          文章檔案(423)

          相冊

          收藏夾(18)

          JAVA

          搜索

          •  

          積分與排名

          • 積分 - 827218
          • 排名 - 49

          最新評論

          閱讀排行榜

          評論排行榜

          package SFIS.DB;
          import java.net.MalformedURLException;
          import java.net.HttpURLConnection;
          import java.net.URL;
          import java.io.BufferedReader;
          import java.io.IOException;
          import java.io.InputStream;
          import java.io.InputStreamReader;

          public class URLConnectionTest {
          public static void main(String []args){
          try {
          long begintime = System.currentTimeMillis();
          URL url = new URL("http://10.240.19.112:8080/quartz/jobs/executeJob.action?jobName=NOTEPAD_JOB&jobGroup=DEFAULT");

          HttpURLConnection urlcon = (HttpURLConnection)url.openConnection();
          System.out.println(urlcon.getResponseCode());
          urlcon.connect();

          //InputStream is = urlcon.getInputStream();
          /*InputStream is = urlcon.getErrorStream();
          if(null != is) {
          BufferedReader buffer = new BufferedReader(new InputStreamReader(is));
          StringBuffer bs = new StringBuffer();
          String l = null;
          while((l=buffer.readLine())!=null){
          bs.append(l).append("\n");
          }
          System.out.println(bs.toString());
          is.close();
          } else if (null == is) {
          System.out.println("Null");
          } else {
          System.out.println("UNKNOW...");
          }*/
          //System.out.println(" content-encode:"+urlcon.getContentEncoding());
          //System.out.println(" content-length:"+urlcon.getContentLength());
          //System.out.println(" content-type:"+urlcon.getContentType());
          //System.out.println(" date:"+urlcon.getDate());
          System.out.println("total time:"+(System.currentTimeMillis()-begintime)+"毫秒");
          urlcon.disconnect();
          } catch (MalformedURLException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
          } catch (IOException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
          }

          }
          }


          posted on 2009-03-20 13:49 Ke 閱讀(656) 評論(0)  編輯  收藏 所屬分類: java
          主站蜘蛛池模板: 启东市| 泊头市| 平泉县| 松阳县| 潮安县| 古丈县| 临汾市| 拜泉县| 梓潼县| 丹凤县| 鄂托克旗| 雷山县| 金秀| 琼中| 贡嘎县| 措勤县| 彭州市| 怀化市| 新野县| 含山县| 漠河县| 白沙| 琼结县| 商河县| 嘉善县| 庆城县| 百色市| 玉龙| 阳西县| 内丘县| 广宗县| 威信县| 南漳县| 锦州市| 浮梁县| 铜梁县| 苗栗市| 东乡县| 孟津县| 马山县| 化州市|