Menu

Expect: 100-Continue

Help
Yaron
2013-10-30
2013-10-31
  • Yaron

    Yaron - 2013-10-30

    From what I can tell the Servlet API doesn't really support Expect: 100-Continue. This is a problem because I am using CouchDB Lite Android Listener for my project and it is based on servlets using TJWS. 100-Continue is extremely useful for my scenarios because all access is authenticated/authorized so before some client sends down a video or big document we can use the 100-Continue mechanism to let them know not to bother.

    Given that the Servlet API doesn't seem to support 100-Continue if it is going to be used with TJWS then some TJWS specific hook is needed, something like http://jira.codehaus.org/browse/JETTY-341.

    Any suggestions on how this might work?

                Thanks,
    
                                                Yaron
    
     
  • Д Рогаткин

    The JIRA link s broken. However I assume that 100 continue can be implemented in the following way
    1. when client sends a request Except: 100-continue, TJWS analyzes status code set by servlet.
    2. If status code neither one of 100 or 417, TJWS automatically replaces it by 417
    3. If status was 100, then TJWS doesn't close or return connection in keep alive pool, it initiates another servlet call but now supplying client data.
    4. Servlet can process the data as usually

     
    • Yaron

      Yaron - 2013-10-31

      Sorry, the link auto detector included the period at the end of the sentence in the link and that is what broke. Try the link below, it should work just fine:

      http://jira.codehaus.org/browse/JETTY-341

      But the much more interesting link is:

      http://www.eclipse.org/jetty/documentation/current/1xx-responses.html

      The previous link explains how Jetty handles 100-Continue and it's really sneaky but makes a ton of sense.

      If they receive a 100-Continue they will hold off on responding until a request is made for getInputStream or equivalent. The idea being that once the servlet has the request object they can look at the request headers and decide if they are going to reject the request. But once they grab the input stream then obviously they intend to read it so a 100-Continue is appropriate.

      That seems like a really cool solution to me and it 'just works'.

                                  Yaron
      

      From: "Д Рогаткин" [mailto:drogatkin@users.sf.net]
      Sent: Wednesday, October 30, 2013 9:17 PM
      To: [tjws:discussion]
      Subject: [tjws:discussion] Expect: 100-Continue

      The JIRA link s broken. However I assume that 100 continue can be implemented in the following way
      1. when client sends a request Except: 100-continue, TJWS analyzes status code set by servlet.
      2. If status code neither one of 100 or 417, TJWS automatically replaces it by 417
      3. If status was 100, then TJWS doesn't close or return connection in keep alive pool, it initiates another servlet call but now supplying client data.
      4. Servlet can process the data as usually


      Expect: 100-Continuehttps://sourceforge.net/p/tjws/discussion/110264/thread/84980e54/?limit=25#146e


      Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/tjws/discussion/110264/

      To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

       

Log in to post a comment.