2010-11-04 68 views
1

我在我的應用程序中實現了嵌入式瀏覽器,並且因爲它必須與OS 4.0兼容,所以BrowserContent是我唯一的選擇。HTTPS頁面未加載到BrowserContent上

打開HTTPS頁面時,屏幕爲空白,但使用BrowserSession時不會發生此問題。所以我在BrowserContent部分之後放置了一個println,並且它不顯示在控制檯輸出中。所以我認爲這是有問題的。

class BrowserScreen extends MainScreen { 
    private RenderingSession _renderingSession; 
    private HttpsConnection _connection; 

    public BrowserScreen(String url) { 
     _renderingSession = RenderingSession.getNewInstance(); 
     final String _url = url; 

     new Thread() { 
      public void run() { 
       try { 
        _connection = 
         (HttpsConnection)Connector.open(_url, Connector.READ, true); 
        BrowserContent content = 
         _renderingSession.getBrowserContent(_connection, null, 0); 
        content.finishLoading(); 
        Field field = content.getDisplayableContent(); 

        synchronized (UiApplication.getEventLock()) { 
         add(field); 
        } 
       } catch (Exception e) { 
        e.printStackTrace(); 
       } 
      } 
     }.start(); 
    } 
} 

回答

1

有樣品中的錯誤,和BB的人在這方面多年來做了什麼。你永遠不會知道,你的頁面不會被渲染,你將全部由被重定向到調用頁面本身。當他們無法呈現頁面時,他們會在HTTP響應中插入一個重定向代碼,而不是提供渲染異常(在輸入流中檢查它並將其轉換爲字符串,您應該知道),並且從不顯示預期頁面。他們已經使用BrowserField在5.0及更高版本中解決了這個問題,但我們需要低端手機的解決方案。