File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Product and Other Certifications and the fly likes testing http connection code on WirelessToolkit? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Product and Other Certifications
Bookmark "testing http connection code on WirelessToolkit?" Watch "testing http connection code on WirelessToolkit?" New topic
Author

testing http connection code on WirelessToolkit?

Terence Doyle
Ranch Hand

Joined: May 30, 2001
Posts: 328
Hi,
I'm trying to test out some code to practice for the exam on the J2ME Wireless Toolkit 2.1
When my code gets to

A message appears on the emulator screen asking for permission to use the network but when I say yes nothing happens...

Any ideas? Or is the kit for local testing only.
Thanks,


Raising Flares debut album 'Ignition' out now

http://www.raisingflares.com

Terry Doyle <br />SCPJ 1.4 , SCWCD , SCMAD(Beta)
Theodore Casser
Ranch Hand

Joined: Mar 14, 2001
Posts: 1902

I get the same thing, but when I click 'OK', it continues onwards like it should. Check the rest of your code to see if it's doing everything it should.
I found really silly incompatibilities when I first ran into this using the first edition of Knudsen - a out.flush() in the Jargoneer MIDlet was seeming to cause a problem, and removing it made the application work. So, basically, double-check your code for any snafus.
(Edited to clarify what I'd found)
[ February 12, 2004: Message edited by: Theodore Casser ]

Theodore Jonathan Casser
SCJP/SCSNI/SCBCD/SCWCD/SCDJWS/SCMAD/SCEA/MCTS/MCPD... and so many more letters than you can shake a stick at!
Terence Doyle
Ranch Hand

Joined: May 30, 2001
Posts: 328
Well it's working now :roll:
Guess it was my ADSL connection...
Thanks,
sha liba
Greenhorn

Joined: Jan 12, 2004
Posts: 5
Two ways to get around this "feature", one is to start a thread in commandAction() for the open() call, the other is to change the protection domain from "untrusted" to trusted under the preference menu.
WTK's release note mentioned this problem, claiming the cause is that accessing a protected API from commandAction() will lock the UI thread. I just could not figure out how that can be the case if the WTK control the thread properly.
Michael Yuan
author
Ranch Hand

Joined: Mar 07, 2002
Posts: 1427
Originally posted by sha liba:
WTK's release note mentioned this problem, claiming the cause is that accessing a protected API from commandAction() will lock the UI thread. I just could not figure out how that can be the case if the WTK control the thread properly.

It is not a "problem". The spec says that commandAction() should "return immediately". So, to use a thread is the only correct way to do this.
cheers
Michael


Seam Framework: http://www.amazon.com/exec/obidos/ASIN/0137129394/mobileenterpr-20/
Ringful: http://www.ringful.com/
sha liba
Greenhorn

Joined: Jan 12, 2004
Posts: 5
I've seen so many code examples from both Sun and IBM developer sites where net work connection are done within the commandAction()....
While it is a good practice to aways start a thread for calls that may block especially in UI application, I still don't understand why failing to do so would "lock up" the UI thread indefinitely.
david goose
Greenhorn

Joined: Feb 12, 2005
Posts: 1
A thread for communication is advisable ? The reason is that
if you are waiting for I/O operations the system cannot perform any paint
operations /and or other events. Older J2ME implementations { < 2} seemed to
service this differntly , but if you think of it the newer model is safer
and provides more control for the vm to interupt or advise of any events , for instance push registry etc... Other than that I dont think there is any other
explanation.

Hope this helps

Goose
Ko Ko Naing
Ranch Hand

Joined: Jun 08, 2002
Posts: 3178
I used to play around with networking-related examples coming along with the Sun Java Studio Mobility Trial Version... The examples are really great... I do recommend that IDE, if you want, to prepare for the exam...


Co-author of SCMAD Exam Guide, Author of JMADPlus
SCJP1.2, CCNA, SCWCD1.4, SCBCD1.3, SCMAD1.0, SCJA1.0, SCJP6.0
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: testing http connection code on WirelessToolkit?
 
Similar Threads
Debug It - recommendations for coverage
one more
JAR Execuatable still persisting!!!!!
stack trace problem, need help understanding.
need help