×

Discussion Board

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

    RE: How to handle a response with HTTP status code 100 (Continue)?

    i've got the same problem. nobody knows the answer to this??

    sorry, this wasn't meant to be an "answer". this is just my first time in this forum, and i dont know what im doing :/

  2. #2
    Regular Contributor
    Join Date
    Mar 2003
    Location
    Rennes, France
    Posts
    50

    RE: How to handle a response with HTTP status code 100 (Continue)?

    Hi,

    I had the same problem. Most Nokia emulators were blocking at the code 100. However, it does work with the j2me wireless toolkit emulators and the series 60 concept SDK v0.1. That was 2 months ago. Since there has been new SDK released, and I haven't tested those. In real devices, it blocked in most series 30 and 40, but it worked fine in series 60 (in the 7650 and i guess in the 3650 too).

    regards,
    Frederic

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

    How to handle a response with HTTP status code 100 (Continue)?

    I am having a problem with handling HTTP responses. The web server (IIS 4.0) always returns status code 100 before sending the actual response with code 200 when the request method is POST. However, when I receive a response with status code 100 and start reading the response content anyway, it looks like this:

    ------------------
    HTTP/1.1 200 OK
    Server: Microsoft-IIS/4.0
    ... (cache headers etc.)

    testing (this is the data)
    ------------------

    The problem is that when I query the header variables (such as Content-Type, Content-Length etc.), they are all null. It seems that the HttpConnection methods return the data of the original response with code 100 instead of the response with code 200, which was sent afterwards.

    If I want to read the actual data of the response, I have to read the whole header before I can access the data. Of course I could write a parser for parsing the header and the data, but because of the 30K limit, this does not seem the best option. Especially because class HttpConnection should do this for me.

    Is this a bug in HttpConnection and if so, is there a workaround for this? I am thinking about setting the HTTP version to 1.0 in the client request properties, but I am hoping there might be a better solution.

    Thanks.

  4. #4
    Registered User
    Join Date
    Apr 2003
    Posts
    1

    http 100 error

    same problem i met.

    i am developing a website programme for the image uploading function of 7650 based on iis+.net. but it responses 100 error while cellphone tries to post a login request through nokia gateway.

    the same programme based tomcat+java do not encount this programme.

    does anyone know how to solve this problem?

  5. #5
    Registered User
    Join Date
    Jul 2003
    Posts
    3
    Hi,

    I have the same problem.

    I am actualy developing a MIDlet (for a Nokia 6600) that communicate with a server (on IIS 6.0) via webservices. That server answer with a status code 100-Continue before sending a 200-OK. All works perfect on the emulator (SUN or Nokia) but not on the real device (the MIDlet is blocked after the 100-Continue).

    Has someone find the solution?

    Thanks

  6. #6
    Registered User
    Join Date
    Nov 2003
    Posts
    10
    Check this out. I got this from Sony Ericsson Forum.
    ----------------------------------------------------------------------
    Ensure correct HTTP response code handling for your Java


    In many cases it's easy to rely on a strategy that any response code other than "200 OK" means that some kind of error occurred. This is especially true with MIDP applications where you want to reduce the amount of code necessary to do the desired task. However it is absolutely necessary to handle some response codes. For example "100 Continue" can sometimes be sent by a server when you are in the middle of doing a POST operation, because some special kind of server is used. Another case could be when the operator installs an HTTP Accelerator that always responds to any HTTP request with a "30x Moved or Redirect" code, and redirects the client to an internal resource where the content is already cached.

    A regular app that only accepts "200 OK" as a successful request will always fail under those circumstances.

    To overcome these issues you might find yourself in a fairly tricky situation. In the case of a "100 Continue" response, the device might not automatically continue and look for the second response code that is sent by the server. Then you would have to write your own response code parser, which takes the content read from the server and translates it into a response code.

    In the case of a "30x Moved/Redirect" situation, you would also have to write your own response parser to read the new URL and issue a new request for this.

    Here's a skeleton for taking care of HTTP responses.
    public void doRequest( String url ) {
    try {
    m_istream = doConnect( url );
    doRead( m_istream, buffer );
    }
    catch( IOException e ) {
    //Handle exception
    }
    finally {
    closeConnection();
    }
    }

    private InputStream doConnect( String url ) throws IOException {
    boolean done = false;

    // Open HTTP connection and read response code from it

    while( !done ) {
    switch( resp ) {
    case 200:
    done = true;
    //open inputstream and return;
    break;
    case 100:
    done = false;
    // open inputstream and read up
    // to the next response code.
    // set resp variable to new code and
    // have another go in the while loop
    break;
    case 300: //include other affected variants
    // open inputstream and parse
    // new URL from it
    // close this inputstream and
    // this connection
    // call ourselves with new url
    break;
    default:
    done = true;
    // treat other codes as errors..
    break;
    }
    }
    // Return inputstream
    }

    private void doRead(InputStream is, byte[] buf) throws IOException {
    // Read the data from the inputstream into the buffer
    }

    private void closeConnection() {
    // Close all streams and connections
    }
    ----------------------------------------------------------------------------
    Regards,
    Balakrishnan

Posting Permissions

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