×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    4

    HTTP Response Headers are sent as part of the content

    I blame it on the gateway, but I'll ask anyway.

    On POST reqiest I recieve HTTP Response Headers as part of the content itself. Yep...


    Any ideas besides yelling on the gateway admins?

  2. #2
    Super Contributor
    Join Date
    Mar 2003
    Location
    Israel
    Posts
    2,280
    We don't know how you're posting the data. We don't know how you're reading the data on the server. So we can't really tell you that you're doing all of that fine.
    Could it be a gateway bug? Possibly. I personally hadn't heard of that one yet, but who knows with these darn gateways. But without knowing anything about how you're doing things, there's no way to confirm your suspicions.

    shmoove

  3. #3
    Registered User
    Join Date
    Mar 2003
    Posts
    4
    Sorry, my fault. It's really simple as that:

    Device: Nokia 6600

    MIDlet:
    ------------------
    HttpConnection c = null;
    InputStream is = null;
    OutputStream os = null;
    String result = null;
    c = (HttpConnection)Connector.open("http://199.203.134.51/servlet/TestServlet");
    c.setRequestMethod("POST");
    c.setRequestProperty("Content-Type", "application/octet-stream");
    is = c.openInputStream();
    StringBuffer sb = new StringBuffer();
    int temp = is.read();
    while (temp != -1)
    {
    sb.append((char)temp);
    temp = is.read();
    }
    is.close();
    c.close();
    ----------------------------

    Servlet:
    ----------------------------------
    public void doPost(HttpServletRequest req, HttpServletResponse resp)
    {
    PrintWriter out = resp.getWriter();
    resp.setContentType("application/octet-stream");
    out.println("This is first line of output");
    out.println("This is the second line");
    out.flush();
    out.close();
    }
    ---------------------------------

    That's all.

    And thanks for your reply.

  4. #4
    Super Contributor
    Join Date
    Mar 2003
    Location
    Israel
    Posts
    2,280
    I can't see anything wrong with that. So you're saying that sb (the string buffer) has the response headers in it?
    Looks like there's a bug somewhere, that's for sure. Try ruling out your server and/or servlet engine by trying the same but not from a phone, ie, write an applet or something with the same functionality of the MIDlet, or even use the MIDlet but configure the phone to use an Internet access point so that it doesn't go through the gateway. If those tests turns out fine, then the gateway is a likely candidate. If the applet test id OK but the MIDlet/access point fails, then it's somewhere withing the network operator's grasp, but not necesarilly the gateway.

    shmoove

  5. #5
    Registered User
    Join Date
    Mar 2003
    Posts
    4
    shmoove, we have very hard relationships with the operator ) We got one entry point to gateway, and this is the only way we can access the net. So I can¡¯t really check anything. I just wanted to be sure, that my side is ok.

    I have checked the Servlet from browser, from emulator and from Applet. Works fine.

    Thanks.
    Last edited by basad; 2004-03-16 at 14:28.

Posting Permissions

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