BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 07-14-2009, 02:54 AM   #1
BB1364
Thumbs Must Hurt
 
Join Date: Oct 2007
Model: 7100i
PIN: N/A
Carrier: Dont know
Posts: 195
Default Https thread problem

Please Login to Remove!

Hi

I have a thread which calls a https url and retrievs data after a specified period of time. I have started the thread in the alternate entry so that even if the device is rebooted the thread starts runnnig up (setting the app as device module and startup on reboot).
The app works works fine when i open up the app the thread runs, i kept the network covrage to OFF and put it ON again it still runs.

But once i close the simulator and on startup of the simulator i keep the network coverage to OFF, then the thread runs but the data is not retrieved from the server .

I have the httpGet method as under:

Code:
public String httpRequest(String url) throws IOException 
    {
        System.out.println(url);
        String result = null;
        HttpsConnection conn = null;
        InputStream input = null;    
        try 
        {
            if( url != null && url.trim().length() > 0)
            {
                conn = (HttpsConnection)Connector.open(url+";EndToEndDesired");
                System.out.println("Conn response "+ conn.getResponseMessage()); 
                if(conn.getResponseCode() == HttpsConnection.HTTP_OK)
                {
                    input = conn.openInputStream();
                    byte[] data = new byte[256];
                    int len = 0;
                    StringBuffer raw = new StringBuffer();
                    while(-1 != (len = input.read(data))) 
                    {
                        raw.append(new String(data, 0, len));
                    }
                    result = raw.toString(); 
                }
            }
            
        } catch(IOException e) {
            System.out.println(e.toString());
            throw e;
        } finally {
             try
             {
                 if(input != null) 
                 {
                    input.close();
                 }
            } catch (IOException e){}
            try
            {
                if (conn != null) 
                {
                    conn.close();
                }
            } catch (IOException e){}           
        }
        System.out.println(result);
        return result;
    }
The statement
Code:
 conn = (HttpsConnection)Connector.open(url+";EndToEndDesired");
                System.out.println("Conn response "+ conn.getResponseMessage());
Never returns anything. Does anyone have any idea.

Thanks
Offline  
Closed Thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


UNTESTED MSA Model Altair 5 Multigas Gas Detector Monitor picture

UNTESTED MSA Model Altair 5 Multigas Gas Detector Monitor

$159.95



MSA ALTAIR 4XR picture

MSA ALTAIR 4XR

$700.00



MSA altair 4X multi gas meter Monitor detector, O2,H2S,CO,LEL Charger calibrated picture

MSA altair 4X multi gas meter Monitor detector, O2,H2S,CO,LEL Charger calibrated

$340.00



MSA Altair 5X Gas Detector Meter *Recently Calibrated and 30 Day Warranty* picture

MSA Altair 5X Gas Detector Meter *Recently Calibrated and 30 Day Warranty*

$795.00



MSA 10042621 Altair 5X Sampling Probe Straight Air-Line 1' Color Black (E2) picture

MSA 10042621 Altair 5X Sampling Probe Straight Air-Line 1' Color Black (E2)

$295.00



MSA altair 4X multi gas meter Monitor detector, O2,H2S,CO,LEL Charger calibrated picture

MSA altair 4X multi gas meter Monitor detector, O2,H2S,CO,LEL Charger calibrated

$450.00







Copyright © 2004-2016 BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of BlackBerry Inc.