Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > midlet error when using httpconnection in netbeans

Reply
Thread Tools

midlet error when using httpconnection in netbeans

 
 
Orson
Guest
Posts: n/a
 
      03-08-2005
hi,
i'm quite new in writing midlets, so maybe answer to my question is
obviuos.
my application needs to use http connection but when i try to run it
the whole emulator (DefaultColorPhone) stops and a message is
displayed that application "wants to send and recieve data using the
network. This will use airtime and may result in charges. Is it ok to
use airtime?". there are two options yes/no but application isn't
responding.
the same situation occurs when i try to run sample application which
use any type of connection.

if anyone had this kind of problem please respond.
yours sincerely
orson
 
Reply With Quote
 
 
 
 
Darryl Pierce
Guest
Posts: n/a
 
      03-13-2005
Orson wrote:
> i'm quite new in writing midlets, so maybe answer to my question is
> obviuos.
> my application needs to use http connection but when i try to run it
> the whole emulator (DefaultColorPhone) stops and a message is
> displayed that application "wants to send and recieve data using the
> network. This will use airtime and may result in charges. Is it ok to
> use airtime?". there are two options yes/no but application isn't
> responding.
> the same situation occurs when i try to run sample application which
> use any type of connection.


Can you show us the code you're using to create the HTTP connection? It
sounds like you're blocking the main thread by opening the connection on
that thread rather than spawning a new thread to handle the connection...

--
Darryl L. Pierce <(E-Mail Removed)>
Visit my homepage: http://mcpierce.multiply.com
"By doubting we come to inquiry, through inquiry truth." - Peter Abelard
 
Reply With Quote
 
 
 
 
ritu ritu is offline
Junior Member
Join Date: Sep 2007
Posts: 3
 
      09-05-2007
Quote:
Originally Posted by Orson
hi,
i'm quite new in writing midlets, so maybe answer to my question is
obviuos.
my application needs to use http connection but when i try to run it
the whole emulator (DefaultColorPhone) stops and a message is
displayed that application "wants to send and recieve data using the
network. This will use airtime and may result in charges. Is it ok to
use airtime?". there are two options yes/no but application isn't
responding.
the same situation occurs when i try to run sample application which
use any type of connection.

if anyone had this kind of problem please respond.
yours sincerely
orson


i want to transfer file from computer to mobile. getting same type of error : do u want to use airtime ? nothing happens irrespective of reply and the midlet hangs..
i tried using localhost.. this time the midlet doesn't hang but instead of reading and displaying file contents, it shows this : 'Error ..'

please reply if anyone has some solution for me

one more thing i need to know is what are the prerequisites for installing eclipse 3.0?
 
Reply With Quote
 
ashok_alex ashok_alex is offline
Junior Member
Join Date: Aug 2008
Posts: 3
 
      08-26-2008
hello im Ashok ,Im facing this same problem when i try to call servlet from midlet by using
(HttpConnection) open(url);
 
Reply With Quote
 
ashok_alex ashok_alex is offline
Junior Member
Join Date: Aug 2008
Posts: 3
 
      08-26-2008
below i pasted the code , in that im facing 'Is it ok to use Airtime?' msg on my midlet screen. plz tell me clearly and i using new thread to establish the connection. eventhough im facing the same problem. explain me clearly
 
Reply With Quote
 
ashok_alex ashok_alex is offline
Junior Member
Join Date: Aug 2008
Posts: 3
 
      08-26-2008
below i pasted the code , in that im facing 'Is it ok to use Airtime?' msg on my midlet screen. plz tell me clearly and i using new thread to establish the connection. eventhough im facing the same problem. explain me clearly

code:

private void callServlet()
{
//throw new UnsupportedOperationException("Not yet implemented");
System.out.println("from call servlet b4 thread start");
//thread.start();

new Thread(this).start();


}




public void run()
{

System.out.println("from run()");

HttpConnection http = null;
InputStream iStrm = null;
boolean ret = false;


String source_stn="MS";
String dest_stn="PER";



String url = "http://localhost:8080/WebUTSApplication/MobileServlet"+"?"+"src_stn=" + source_stn+"&"+"des_stn=" + dest_stn;
//String url = "http://localhost:8080/WebUTSApplication/MobileServlet";
// String baseurl = "http://localhost:8080/WebUTSApplication/MobileServlet";
System.out.println("URL ="+url);


try {

System.out.println("with in try block");
http = (HttpConnection) Connector.open(url);
System.out.println("after open url");
//http = open(url);
http.setRequestMethod(HttpConnection.POST);

//http.setRequestMethod(HttpConnection.GET);



} catch (IOException ex) {
ex.printStackTrace();
}
}
 
Reply With Quote
 
 
 
Reply

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
HTTPConnection - verbose error messages guyzdancin Java 2 01-13-2006 05:02 PM
HTTPConnection - verbose error messages guyzdancin Java 0 01-11-2006 08:08 PM
J2ME Midlet NetBeans 4.1 HTTP jpuopolo@mvisiontechnology.com Java 0 09-18-2005 05:06 AM
Midlet distribution as .prc in NetBeans Kenneth P. Turvey Java 1 11-22-2004 02:03 AM
Making multiple HTTP requests using same HttpConnection object in j2me Ravi Ambros Wallau Java 0 10-25-2004 06:50 PM



Advertisments