0

How do I open a PDF file through the BB default browser? Currently I am using the below code, but it is throwing a HTTP Error 500: Internal server Error

public static void openBrowser(String url, String contentType, 
            Object objBody ) { 

        final HttpHeaders requestHeaders = new HttpHeaders();
        requestHeaders.addProperty(HttpHeaders.HEADER_CONTENT_TYPE, contentType);

        final URLEncodedPostData postData = 
            new URLEncodedPostData(URLEncodedPostData.DEFAULT_CHARSET, false);
        postData.setData(objBody);
        BrowserSession browserSession = Browser.getDefaultSession();
        browserSession.displayPage(url);//, null, requestHeaders, postData);
        browserSession.showBrowser();
    }
Emil Vikström
  • 90,431
  • 16
  • 141
  • 175
Sam-In-TechValens
  • 2,501
  • 4
  • 34
  • 67

2 Answers2

1

HTTP error 500 indicates an Internal Server Error which is on your web server, rather than anything to do with the BlackBerry. Investigate your web server logs to find the cause.

donturner
  • 17,867
  • 8
  • 59
  • 81
0

I'm not sure what OS version you're limited to, but a lot of apps are still needing to support 5.0 ...

... amazingly, there doesn't appear to be PDF support yet in that browser. Here's a workaround for viewing with Google Docs.

You'd simply need to reformat the URL if you detect that it's a PDF file.

Note: I don't disagree with donturner about HTTP 500 being a server error. But, BlackBerry does some crazy things, and I think if this isn't a symptom of the lack of PDF support in your browser, you (or others reading this post) may run into that later. Also, it's entirely possible that RIM's OS or middleman network infrastructure is generating a 500 response because they know their limitations.

Community
  • 1
  • 1
Nate
  • 31,017
  • 13
  • 83
  • 207