BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 11-15-2007, 02:48 PM   #1 (permalink)
Knows Where the Search Button Is
 
Join Date: Nov 2007
Model: 8700c
PIN: N/A
Carrier: AT&T
Posts: 32
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Http connection problems..

Please Login to Remove!

Having trouble again, sorry guys..

Code:
        HttpConnection conn = null;
Code:
                {
                    System.out.println("try");
                    conn = null;
                    conn = (HttpConnection)Connector.open(URL);
                    
                    conn.setRequestMethod(HttpConnection.POST);
                    
                    conn.setRequestProperty("User-Agent", "BlackBerry/3.2.1");
                    
                    String lang = conn.getRequestProperty("Content-Language");
                    System.out.println("set");
                    InputStream in = conn.openInputStream();
                    System.out.println("e0");
                    byte[] data = new byte[256];
                    System.out.println("e1");
                    int len = 0;
                    System.out.println("e2");
                    StringBuffer raw = new StringBuffer();
                    System.out.println("bw");
                    while (-1 != (len = in.read(data)) )
                    {
                        raw.append(new String(data, 0, len));
                    }
                    String text = raw.toString();
                    
                    System.out.println(text);
                }
                catch (IOException e)
                {System.out.println("catch");
                    System.err.println(e.toString());
                }
It gets to display "try" and "set" but not "e0". so it's getting stuck at conn.openInputStream() for some reason.

I just tried to output the value stored in "lang" and got a "null". Does that mean that the application isn't setting up conn properly? What am i doing wrong? About to go crazy here
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

Switch for Minneapolis Moline, Oliver, Cockshutt, Massey Harris & Other Tractors
$12.95
Switch for Minneapolis Moline, Oliver, Cockshutt, Massey Harris & Other Tractors pictureNeutral Safety Switch & Boot for Massey Ferguson 88 135 150 165 175 180 230 235
$27.95
Neutral Safety Switch & Boot for Massey Ferguson 88 135 150 165 175 180 230 235  picture1PC Meanwell T-50A multi-channel switching power supply + 5V + 12V-5V DC output
$22.06
1PC Meanwell T-50A multi-channel switching power supply + 5V + 12V-5V DC output  picture10pcs RJH60F5DPQ RJH60F5 600V 40A IGBT High Speed Power Switching Renesas TO-247
$15.8
10pcs RJH60F5DPQ RJH60F5 600V 40A IGBT High Speed Power Switching Renesas TO-247 pictureSQUARE D H361 SAFETY SWITCH FUSIBLE, 3PST, 30A, 600V, NEW in Box
$89.0
SQUARE D  H361  SAFETY SWITCH  FUSIBLE, 3PST, 30A, 600V, NEW in Box picture






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