Package org.xlightweb.AbstractHttpConnection

Examples of org.xlightweb.AbstractHttpConnection.IMessageHeaderHandler


        requestHeader.setBodyDefaultEncoding(httpConnection.getBodyDefaultEncoding());
       
      httpConnection.setLastTimeHeaderReceivedMillis(System.currentTimeMillis());
      httpConnection.incCountMessageReceived();

      IMessageHeaderHandler messageHeaderHandler = httpConnection.getMessageHeaderHandler();
      if (messageHeaderHandler == null) {
        throw new IOException("no message handler set");
      }
     
     
      HttpRequest request = null;
     
      switch (getBodyType(requestHeader)) {
       
        case BODY_TYPE_EMTPY:
          request = new HttpRequest(requestHeader);
          IMessageHandler messageHandler = messageHeaderHandler.onMessageHeaderReceived(request);
          messageHandler.onMessageReceived();
         
          rawData = HttpUtils.compact(rawData);
          reset();
         
          // next request? (-> pipelining)
          if (rawData != null) {
            return onData(httpConnection, rawData);
          }               
         
          break;
         
        case FULL_MESSAGE:
          AbstractNetworkBodyDataSource dataSource = new FullMessageBodyDataSource(requestHeader, httpConnection);
          setBodyDataSource(dataSource);
         
          request = new HttpRequest(requestHeader, dataSource);
          messageHandler = messageHeaderHandler.onMessageHeaderReceived(request);
          setMessageHandler(messageHandler);
         
          setState(RECEIVING_BODY);
         
          request.getNonBlockingBody().setBodyDataReceiveTimeoutMillis(httpConnection.getBodyDataReceiveTimeoutMillis());
          return parserBody(httpConnection, rawData);
         
        default// BODY_TYPE_CHUNKED
          dataSource = new FullMessageChunkedBodyDataSource(httpConnection, requestHeader);
            setBodyDataSource(dataSource);
               
            request = new HttpRequest(requestHeader, dataSource);

          messageHandler = messageHeaderHandler.onMessageHeaderReceived(request);
          setMessageHandler(messageHandler);

          setState(RECEIVING_BODY);

          request.getNonBlockingBody().setBodyDataReceiveTimeoutMillis(httpConnection.getBodyDataReceiveTimeoutMillis());
View Full Code Here

TOP

Related Classes of org.xlightweb.AbstractHttpConnection.IMessageHeaderHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.