Package one.nio.http

Class HttpSession

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    public class HttpSession
    extends Session
    • Field Detail

      • MAX_REQUEST_BODY_LENGTH

        private static final int MAX_REQUEST_BODY_LENGTH
        See Also:
        Constant Field Values
      • FIN

        protected static final Request FIN
      • pipeline

        protected final java.util.LinkedList<Request> pipeline
      • fragment

        protected final byte[] fragment
      • fragmentLength

        protected int fragmentLength
      • requestBodyOffset

        protected int requestBodyOffset
      • parsing

        protected Request parsing
      • handling

        protected volatile Request handling
    • Constructor Detail

    • Method Detail

      • checkStatus

        public int checkStatus​(long currentTime,
                               long keepAlive)
        Overrides:
        checkStatus in class Session
      • processRead

        protected void processRead​(byte[] buffer)
                            throws java.io.IOException
        Overrides:
        processRead in class Session
        Throws:
        java.io.IOException
      • handleSocketClosed

        protected void handleSocketClosed()
      • getMaxRequestBodyLength

        protected int getMaxRequestBodyLength()
      • startParsingRequestBody

        protected int startParsingRequestBody​(java.lang.String contentLengthHeader,
                                              byte[] buffer,
                                              int offset,
                                              int remaining)
                                       throws java.io.IOException,
                                              HttpException
        Throws:
        java.io.IOException
        HttpException
      • handleParsedRequest

        protected void handleParsedRequest()
                                    throws java.io.IOException
        Throws:
        java.io.IOException
      • processHttpBuffer

        protected int processHttpBuffer​(byte[] buffer,
                                        int length)
                                 throws java.io.IOException,
                                        HttpException
        Throws:
        java.io.IOException
        HttpException
      • sendResponse

        public void sendResponse​(Response response)
                          throws java.io.IOException
        Throws:
        java.io.IOException
      • sendError

        public void sendError​(java.lang.String code,
                              java.lang.String message)
                       throws java.io.IOException
        Throws:
        java.io.IOException
      • writeResponse

        protected void writeResponse​(Response response,
                                     boolean includeBody)
                              throws java.io.IOException
        Throws:
        java.io.IOException