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

OEM NEW IBM LCD Pole Display Unit 15K2012 For IBM POS - QTY +
$30.18
OEM NEW IBM LCD Pole Display Unit 15K2012 For IBM POS - QTY + pictureNEW OEM IBM SELECTRIC III TYPEWRITER PART PAPER BAIL ARMS ORIGINAL NOS
$9.99
NEW OEM IBM SELECTRIC III TYPEWRITER PART PAPER BAIL ARMS ORIGINAL NOS pictureIBM Selectric Typewriter Part Power Switch OEM 1175205 (Meter Tested GOOD)
$5.99
IBM Selectric Typewriter Part Power Switch OEM 1175205 (Meter Tested GOOD) pictureIBM Actionwriter Printwheels OEM New Lot of 9
$89.99
IBM Actionwriter Printwheels OEM New Lot of 9 pictureOEM IBM SurePOS 700 4800-743/783 250W Power Supply DPS-250AB-45A 73Y0517 73Y0518
$64.99
OEM IBM SurePOS 700 4800-743/783 250W Power Supply DPS-250AB-45A 73Y0517 73Y0518 picture






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