Java Code Examples for org.eclipse.jetty.websocket.common.io.http.HttpResponseHeaderParser

Following code examples demonstrate how to use org.eclipse.jetty.websocket.common.io.http.HttpResponseHeaderParser from jetty. These examples are extracted from various highly rated open source projects. You can directly use these code snippets or view their entire linked source code. These snippets are extracted to provide contextual information about how to use this class in the real world. These samples also let you understand some good practices on how to use org.eclipse.jetty.websocket.common.io.http.HttpResponseHeaderParser and various code implementation of this class.
Example 1
Project : jetty Source File : UpgradeConnection.java View Source Code on GitHub

        @Override
        public void failed(Throwable cause)
        {
            if (LOG.isDebugEnabled())
            {
                LOG.debug("Upgrade Request Write Failure",cause);
            }
            super.failed(cause);
            state = State.FAILURE;
            connectPromise.failed(cause);
        }
			
Example 2
Project : jetty Source File : BlockheadClient.java View Source Code on GitHub

    }

    public HttpResponse readResponseHeader() throws IOException
    {
        HttpResponse response = new HttpResponse();
        HttpResponseHeaderParser respParser = new HttpResponseHeaderParser(response);

        byte buf[] = new byte[512];

        while (!eof)
        {
            int available = in.available();
            int len = in.read(buf,0,Math.min(available,buf.length));
            if (len < 0)
            {
                eof = true;
                break;
            }
            else if (len > 0)
            {
                ByteBuffer bbuf = ByteBuffer.wrap(buf,0,len);
                if (LOG.isDebugEnabled())
                {
                    LOG.debug("Read {} bytes: {}",len,BufferUtil.toDetailString(bbuf));
                }
                if (respParser.parse(bbuf) != null)
                {
                    break;
                }
            }
        }

        remainingBuffer = response.getRemainingBuffer();

        return response;
    }