BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 07-14-2009, 02:54 AM   #1 (permalink)
Thumbs Must Hurt
 
Join Date: Oct 2007
Model: 7100i
PIN: N/A
Carrier: Dont know
Posts: 195
Post Thanks: 0
Thanked 0 Times in 0 Posts
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


Thread Tools

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Vintage Hammermill Continuous Feed Thermal Transfer Printer Paper Apple Scribe
$49.99
Vintage Hammermill Continuous Feed Thermal Transfer Printer Paper Apple Scribe pictureVintage Jaffrey Mfg. Co. Apple Grinder Fruit Press Cast Iron
$120.0
Vintage Jaffrey Mfg.  Co. Apple Grinder Fruit Press Cast Iron  pictureUU1: Vintage Apple Powerbook Low Power AC Adapter ADP-17AB
$22.99
UU1: Vintage Apple Powerbook Low Power AC Adapter ADP-17AB pictureVINTAGE NEXT COMPUTER POWER SUPPLY APS-21 STEVE JOBS APPLE
$299.99
VINTAGE NEXT COMPUTER POWER SUPPLY APS-21 STEVE JOBS APPLE pictureApple Macintosh IIcx M5850 - Vintage
$36.44
Apple Macintosh IIcx M5850 - Vintage picture






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