×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    7

    6610 Http Connection Problem, Nokia Support people, please answer!!!!!!

    I am bit tired of continue nagging Nokia Support people for help.

    I posted the following question to this forum 4 weeks ago, and no responses or answers from Nokia is given to me. I just need to know:

    1. It's that a bug, or is there any solution to enable Http Connection on Nokia 6610 and 6100 Phone. Is there is a solution, could Nokia people post a sample code that enable Nokia 6610 estlablish Http Connection to an URL which consists subdirectory.

    2. Is there is a bug, when firm ware will be released to fixed the bug..



    Thanks




    Hi to Nokia Support

    It seem like Nokia 6610 could not open http connection from any url with subdirectory, eg (www.mycompany.com/subdirectory/readme.txt)

    I wrote a simple midlet that read content from a website,parse the content and present information to user, The midlet have not problem to read content from www.yahoo.com www.cnn.com, however, an IOException is thrown when I direct the midlet to read content from URL consists subdirectory.

    I have follow this discussion board for a while, It's seem to me, Nokia does not produce a good quality Java Phone, 7650 yeild a lot of problem, and same to 6610.

    As a J2ME developer, I am disappointed and would not recommends and Nokia Phone to my Client, including local wireless operator, cause, none of my Java Application works on Nokia Phone, that works fine on other phone.

    Regards

  2. #2
    Nokia Developer Expert
    Join Date
    Mar 2003
    Posts
    382

    RE: 6610 Http Connection Problem, Nokia Support people, please answer!!!!!!

    Hello

    I Have small Http connection MIDlet which has no problem to get data under subdirectory.
    It has been working in all the devices, so I dont see that there is problems in phones.

    This code is really basic level and it is just fetching some data out from the server and then reads wanted part of it and displays it in screen.

    public http_fetch()
    {

    Form foo = new Form("Fetch device data"
    addr = new TextField("Enter wwww addr","http://www.veikkaus.fi/script/peli/keno_tuoreimmat.jsp",100, TextField.URL);

    foo.append(addr);
    foo.addCommand(fetch);
    foo.setCommandListener(this);

    display = Display.getDisplay(this);
    display.setCurrent(foo);
    }


    private void downloadPage(String url) throws IOException {


    StringBuffer b = new StringBuffer();
    InputStream is = null;
    HttpConnection c = null;
    TextBox t = null;

    String Document="";


    try {
    long len = 0 ;
    int ch = 0;

    char tmp =' ';

    c = (HttpConnection)Connector.open(url);

    is = c.openInputStream();

    len =c.getLength() ;
    if ( len != -1)
    {
    // Read exactly Content-Length bytes
    for (int i =0 ; i < len ; i++ )
    {
    if ((ch = is.read()) != -1)
    {
    b.append((char) ch);


    }
    }
    }
    else {
    // Read till the connection is closed.
    while ((ch = is.read()) != -1)
    {
    len = is.available() ;

    b.append((char) ch);

    }
    }

    Document = b.toString();
    String temp = null;




    int start = Document.length()-400;

    for(int i=0;i<100;i++)
    {
    temp+=Document.charAt(start+i);
    }


    Form f = new Form(""
    StringItem s = new StringItem("result", temp);
    f.append(s);
    display.setCurrent(f);

    }

    catch(Exception e)
    {
    Form f = new Form(""
    StringItem s = new StringItem("Exception", Document);
    f.append(s);
    display.setCurrent(f);
    }
    finally
    {
    is.close();
    c.close();

    }

    }

    public void commandAction(Command c, Displayable d)
    {


    String label = c.getLabel();

    if (label.equals("fetch&quot)
    {
    url = addr.getString();

    try {
    downloadPage(url);
    }
    catch(IOException e) {}

    }


    }

  3. #3
    Registered User
    Join Date
    Mar 2003
    Posts
    7

    RE: 6610 Http Connection Problem, Nokia Support people, please answer!!!!!!

    Hi Jalev

    I just compare your code and my code, and the different I found is your code does not check the connection response code prior open the connection input stream, there is your code does not include the following line:

    int responseCode = connection.getResponseCode();

    I will let you know if I remove the above line, My Midlet will still work in Nokia Phone later.

    Please verify..thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×