HTTPS page not loaded on BrowserContent

╄→尐↘猪︶ㄣ 提交于 2019-12-08 08:21:36

问题


I am implementing an embedded browser in my app, and because it has to be compatible with OS 4.0, BrowserContent is my only choice.

When opening a HTTPS page the screen is blank, but this problem doesn't occur when a BrowserSession is used. So I put a println after the BrowserContent part, and it doesn't show up in the console output. So I think this is something wrong with that.

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:


There is a bug in the sample, and the BB people have done nothing in this regards for years.. You will never know that your page is not rendered and you will be redirected to the calling page all by itself. When they are unable to render the page they insert a redirection code in the HTTP response instead of giving a render exception (check it out in the inputstream and convert it into string and you shall know), and the intended page is never shown. They have resolved this in 5.0 and higher using BrowserField, but we need solution for the low end mobiles.



来源:https://stackoverflow.com/questions/4093634/https-page-not-loaded-on-browsercontent

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!