JWorld@TW the best professional Java site in Taiwan
      註冊 | 登入 | 全文檢索 | 排行榜  

» JWorld@TW » Application Server » Tomcat  

按列印兼容模式列印這個話題 列印話題    把這個話題寄給朋友 寄給朋友   
reply to postflat modego to previous topicgo to next topic
己加入精華區
by koji at 2007-12-12 17:25
本主題所含的標籤
無標籤
作者 Re:Tomcat SSL 問題 [Re:secretguest0824]
secretguest0824

別當出頭鳥



發文: 354
積分: 1
於 2006-12-25 14:34 user profilesend a private message to usersend email to secretguest0824reply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
各位大大好:
我參考了網路上的程式碼將程式改成下面這樣
但還是出現sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
我應該要看哪方面的資訊呢...

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
public boolean SendSSL (File file,String strSuccessMessage) throws NetworkErrorException
  {
    boolean boolRetrun = false;
    try {
      SSLServerSocketFactory sslserversocketfactory =
                (SSLServerSocketFactory) SSLServerSocketFactory.getDefault();
      SSLServerSocket sslserversocket =
                (SSLServerSocket) sslserversocketfactory.createServerSocket(intSSLPort);
      SSLSocket sslsocket = (SSLSocket) sslserversocket.accept();
      
      FileInputStream bf=new FileInputStream(file);
          DataOutputStream printout = new DataOutputStream(sslsocket.getOutputStream());
          byte[] buf = new byte[2048];
      int num = bf.read(buf);
      while (num != (-1))// 是否讀完文件 
      {  
        printout.write(buf, 0, num);// 把文件內容寫到網路緩衝區
        num = bf.read(buf);// 繼續從文件中讀取數據
 
      }
      printout.flush();// 把緩衝區的數據寫往客戶端
      bf.close();
      printout.close();
      BufferedReader input = new BufferedReader(new InputStreamReader(
          sslsocket.getInputStream()));
      String str = input.readLine().trim();
      if (str.equals(strSuccessMessage)) {
        boolRetrun = true;
      } else {
        boolRetrun = false;
      }
 
    } catch (IOException ce) {
      if(TroubleDetector.DetectServer(this.url.getHost(), 80));
      throw new NetworkErrorException("網路發生問題!!",ce);
    }
    catch(Exception ce)
    {
      ce.printStackTrace();
      throw new NetworkErrorException("傳輸檔案發生問題!!",ce);
    }
    return boolRetrun;
  }


reply to postreply to post
話題樹型展開
人氣 標題 作者 字數 發文時間
15606 [精華] Tomcat SSL 問題 secretguest0824 1298 2006-12-22 14:50
13471 Re:Tomcat SSL 問題 secretguest0824 3255 2006-12-22 17:09
7040 Re:Tomcat SSL 問題 zrjian 89 2009-05-21 17:12
6974 Re:Tomcat SSL 問題 secretguest0824 201 2009-05-21 17:21
7020 Re:Tomcat SSL 問題 zrjian 439 2009-05-21 17:54
6985 Re:Tomcat SSL 問題 secretguest0824 763 2009-05-21 18:19
6952 Re:Tomcat SSL 問題 zrjian 664 2009-05-21 19:03
7062 Re:Tomcat SSL 問題 zrjian 168 2009-05-25 10:49
13790 Re:Tomcat SSL 問題 secretguest0824 1700 2006-12-25 14:34
13086 Re:Tomcat SSL 問題 secretguest0824 2543 2006-12-26 17:45
12999 Re:Tomcat SSL 問題 secretguest0824 69 2006-12-26 17:49
13052 Re:Tomcat SSL 問題 secretguest0824 109 2006-12-26 18:19
10648 Re:Tomcat SSL 問題 secretguest0824 227 2007-12-12 15:50
10890 Re:Tomcat SSL 問題 secretguest0824 713 2007-12-12 16:29
10677 Re:Tomcat SSL 問題 frankiakimo 46 2008-01-02 10:05
6544 Re:Tomcat SSL 問題 porsa 228 2009-07-29 17:54
6507 Re:Tomcat SSL 問題 tuu 375 2009-07-29 23:03
6510 Re:Tomcat SSL 問題 porsa 944 2009-07-30 09:09
7295 Re:Tomcat SSL 問題 tuu 331 2009-07-30 09:58
» JWorld@TW »  Application Server » Tomcat

reply to postflat modego to previous topicgo to next topic
  已讀文章
  新的文章
  被刪除的文章
Jump to the top of page

JWorld@TW 本站商標資訊

Powered by Powerful JuteForum® Version Jute 1.5.8