You Are Here:

Community: Wiki

 

Talk:Fetching data from server

From Forum Nokia Wiki

Reviewer Approved   

Review:

This article mainly consists of a code example showing how to use the HttpConnection to retrieve data using HTTP protocol. The code example shows how to open an HTTP connection to a particular URL. The code also demonstrates a few other useful things relating to working with HTTP connections in Java ME, including how to set different properties of an HTTP request. The code also demonstrates the correct way of working with an HTTP Connection – first retrieve the response code and check that it is HTTP_OK (not some error like 404), and only if this is the case does the code open an input stream and retrieve the required data. The reader is also reminded of the need to close the connection.

The code is nicely commented for explanatory purposes. One thing that is lacking is a better example of dealing with the different kinds of exceptions which can occur when transferring data over an HTTP connection.

This is a nice simple example for those who have never worked with the HttpConnection class before as it demonstrates its use in an easy to understand example.

--Larry101 09:30, 25 September 2009 (UTC)

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia