×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Regular Contributor
    Join Date
    Nov 2005
    Location
    India
    Posts
    101

    HttpConnection UserAgent

    Hi all,
    I was trying to make http connection in a midlet.

    HttpConnection hc=(HttpConnection)Connector.open(url, Connector.READ_WRITE, true);
    hc.setRequestMethod(HttpConnection.GET);


    And I want to get handset mobile model info at the server end. My server end is a servlet, I am using request.getHeader. But not getting any header information.

    Enumeration hdrs = request.getHeaderNames();
    if(hdrs != null)
    {
    while(hdrs.hasMoreElements())
    {
    hcName = (String)hdrs.nextElement();
    hcValue = (String)request.getHeader(hcName);
    wui.setLOG(" name : " + hcName + ", value : " + hcValue + "\r\n");
    }
    }


    I am getting this at server end
    HOST: xx.xx.xx.xx
    CONNECTION: close


    Please help

    vaish.ankur@gmail.com
    yahoo id vaish_ankur_cdac@yahoo.com

  2. #2
    Super Contributor
    Join Date
    Dec 2005
    Location
    Europe/Poland/Warsaw
    Posts
    1,697

    Re: HttpConnection UserAgent

    hi,

    use setRequestProperty available in HttpConnection:e.g
    c.setRequestProperty("User-Agent",
    "Profile/MIDP-2.0 Configuration/CLDC-1.0");
    c.setRequestProperty("CONTENT-TYPE","application/x-www-form-urlencoded");
    c.setRequestProperty("Content-Language", "en-US");
    ....
    also run emulator (Nokia SDK Emulator) and use Utilieties to trace headers send from emulator to server,

    hth,
    regards,
    Peter

Similar Threads

  1. HttpConnection through a wap gw with Nokia 6600
    By ntalfer in forum Mobile Java Networking & Messaging & Security
    Replies: 4
    Last Post: 2006-01-20, 14:29
  2. HttpConnection issue with Nokia 6600
    By akhilss in forum Mobile Java Networking & Messaging & Security
    Replies: 2
    Last Post: 2005-04-08, 17:30
  3. Is this HttpConnection Bug on 7610?
    By cars2003 in forum Mobile Java General
    Replies: 0
    Last Post: 2004-10-28, 10:12
  4. jsme symbian error HttpConnection
    By tomereg in forum Symbian
    Replies: 0
    Last Post: 2004-04-05, 10:50
  5. Problem with HttpConnection in NOKIA 7650
    By abaxia in forum Mobile Java General
    Replies: 0
    Last Post: 2003-03-06, 15:27

Posting Permissions

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