File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java Micro Edition and the fly likes How to foce Nokia 7210 SDK to use HTTP rather than WAP? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "How to foce Nokia 7210 SDK to use HTTP rather than WAP?" Watch "How to foce Nokia 7210 SDK to use HTTP rather than WAP?" New topic

How to foce Nokia 7210 SDK to use HTTP rather than WAP?

Chua Wen Ching

Joined: Sep 28, 2003
Posts: 3
Hi there,
In the Nokia 7210 Emulator, I click File -> New
and i enter my ip address called:
I can't get the phone to access it...
so I play with the Tools -> Settings
and under Wap Networking, the gateway ip is (i try to set it to 0.0.0, but can't work)
and under the MIDlet Networking, i already check the Enable HTTP communication checkbox.
To QC, i go to Tools -> Status Window
AND I notice that no matter what it still goes to WAP Communication Requests 1 (the counter will increment)
The HTTP Communication, Request still 0. (i try to connect to the internet, also http request is still 0)
Sad story, so i do some coding in servlest and midlets
Well i learn from the java sun website...
Below is the source code:
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
* An example MIDlet to invoke a CGI script.
public class FirstMidletServlet extends MIDlet {
private Display display;
String url =
public FirstMidletServlet() {
display = Display.getDisplay(this);
//Initialization. Invoked when MIDlet activates
public void startApp() {
try {
} catch (IOException e) {
System.out.println("IOException " + e);
//Pause, discontinue ....
public void pauseApp() { }
//Destroy must cleanup everything.
public void destroyApp(boolean unconditional) { }
//Prepare connection and streams then invoke servlet.
void invokeServlet(String url) throws IOException {
HttpConnection c = null;
InputStream is = null;
StringBuffer b = new StringBuffer();
TextBox t = null;
//Form t = null;
try {
c = (HttpConnection);
"20 Jan 2001 16:19:14 GMT");
"Profile/MIDP-1.0 Configuration/CLDC-1.0");
c.setRequestProperty("Content-Language", "en-CA");
is = c.openDataInputStream();
int ch;
// receive response and display it in a textbox.
while ((ch = != -1) {
b.append((char) ch);
t = new TextBox("First Servlet",
b.toString(), 1024, 0);
// t = new Form(b.toString());
} finally {
if(is!= null) {
if(c != null) {
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
* The simplest possible servlet.
public class HelloServlet extends HttpServlet {
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException {
PrintWriter out = response.getWriter();
out.println("Servlet invoked!");
out.println(new Date());
And it works fine. I can see now it goes directly to Http rather than Wap anymore.
*Note: The servlets and compilation of the java works fine.
Any idea. How to make the emulator possible to "force-to-point" at HTTP rather than WAP.
Chua Wen Ching
I agree. Here's the link:
subject: How to foce Nokia 7210 SDK to use HTTP rather than WAP?
It's not a secret anymore!