• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

HTTPConnection MIDlet in Ch.7 of SCMAD Exam guide

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Sathya, Ko Ko

I'm executing the HTTP Connection (Listing 7.1) from the book on Nokia S40 emulator. On Launching the MIDlet get the message, "HTTPMIDlet running. Nothing to display". The url I'm using is http://google.com. I am also printing some values set in the HTTPConnection as given below-
lastModified: 0
host : google.com
encoding: null
url: http://google.com
port: 80
content type: text/html; charset=UTF-8
got content type: text/html; charset=UTF-8
total bytes read: 1391
got data:[B@d590dbc

Is this output as expected? Probably it would open the web page while running on the actual device. (Currently do not have an S40 device handy)

Regards,

 
Ranch Hand
Posts: 379
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

The connection and messaging examples provided in the book are to show how to use the API and aren't really full applications. In this case, you are getting the "Nothing to display" message because no screen instance is instantiated and associated with the Display within the MIDlet. In essence, this MIDlet has no user interface, and hence the message.

Also, the MIDlet by itself does not act as a browser and hence getting the HTTP data doesn't mean it can be displayed. A more practical scenario working on the same example would be if you have an RSS feed in a website, you can get the contents of the feed, parse the XML, and display it in a way you want to.

So, the result you saw was expected.
 
Jane Joseph
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your explanation.

I believe google website has a RSS feed. Though I do not know much about getting the contents, parsing the XML and displaying it on my UI on mobile. Am looking up for some info on the same. By chance you have some links/tutorials for the same, I'll be glad if you could share it.

Regards,
 
Your mother was a hamster and your father was a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic