Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Developer
Posts: 35
Registered: ‎11-26-2008
My Device: 8100

how can i show http response

i want to know

1) how can i make http request

2) and how to show it's respnse to screen

 

i use JDE 4.2 and simulator is 9530

 

help plz

Developer
Posts: 17,026
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: how can i show http response

take a look at the different http demo samples that ship with the JDE
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
New Developer
Posts: 4
Registered: ‎12-12-2008
My Device: Not Specified

Re: how can i show http response

1. Use HttpConnection. Remember to use it in the separate thread so your UI doesn't lock until server responds.

2. Depends on what you want to display. You can add elements to the screen (labels, lists, etc) and pass your data to them.

In addition to the samples, I would suggest you look through developer guide (both basic and advanced)  - that would give you better understanding how to put everything together.

New Developer
Posts: 26
Registered: ‎12-03-2008
My Device: Not Specified

Re: how can i show http response

Check out http://www.riccomini.name/Topics/Mobile/BlackBerry/BlackBerryHTTPClient/

 

Code snippet of how to make an HTTP call. Also works with HTTPS.

BlackBerry/Mobile Enthusiast - http://www.riccomini.name
Highlighted
Developer
Posts: 1,415
Registered: ‎07-30-2008
My Device: Not Specified

Re: how can i show http response

if by response, you mean the response headers and not content, try stuff like this,

 

HttpConnection m_hc;
   k=m_hc.getHeaderFieldKey(i);
   if (k==null) break; 
      k=k.toLowerCase();
   String v=m_hc.getHeaderField(i);

if ( k!=null) xx+=k+ " "+v+"\n\r";
   if (k.equalsIgnoreCase("something"))...

++i;

Developer
Posts: 17,026
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: how can i show http response

HttpConnection offers the method getResponseCode. Here is an example, stripped it down a bit:

conn = (HttpConnection) Connector.open(url);
// if connection requires login
if (conn.getResponseCode() == 401) {
//basicauthconn
} else if (conn.getResponseCode()==200{
//proceed
}
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter