Package com.ramforth.webserver.http.headers.general

Examples of com.ramforth.webserver.http.headers.general.TransferEncodingHttpHeader


                break;
            case "content-type":
                header = new ContentTypeHttpHeader(rawValue);
                break;
            case "transfer-encoding":
                header = new TransferEncodingHttpHeader(rawValue);
                break;
            case "content-disposition":
                header = new ContentDispositionHttpHeader(rawValue);
                break;
            default:
View Full Code Here


            ContentLengthHttpHeader contentLengthHeader = ((ContentLengthHttpHeader) httpHeaders.getHeader("Content-Length"));
            ContentTypeHttpHeader contentTypeHeader = ((ContentTypeHttpHeader) httpHeaders.getHeader("Content-Type"));

            IHttpHeader transferEncoding = httpHeaders.getHeader("Transfer-Encoding");
            TransferEncodingHttpHeader transferEncodingHeader = null;
            if (transferEncoding != null) {
                transferEncodingHeader = (TransferEncodingHttpHeader) transferEncoding;
            }

            if (contentLengthHeader != null) {
                IHttpRequestBodyParser bodyParser = bodyParserFactory.build(contentTypeHeader, transferEncodingHeader);
                IHttpRequestBodyData bodyData = null;
                InputStream contentLengthInputStream = new ContentLengthInputStream(is, contentLengthHeader.getValue());
                if (transferEncodingHeader != null && transferEncodingHeader.getValue().equalsIgnoreCase("chunked")) {
                    ChunkedInputStream cis = new ChunkedInputStream(contentLengthInputStream, httpHeaders);
                    bodyData = bodyParser.parse(cis);
                } else {
                    bodyData = bodyParser.parse(contentLengthInputStream);
                }
View Full Code Here

    public byte[] parseBody(InputStream is, IHttpHeaders headers) {
        ContentLengthHttpHeader contentLengthHeader = ((ContentLengthHttpHeader) headers.getHeader("Content-Length"));
        ContentTypeHttpHeader contentTypeHeader = ((ContentTypeHttpHeader) headers.getHeader("Content-Type"));

        IHttpHeader transferEncoding = headers.getHeader("Transfer-Encoding");
        TransferEncodingHttpHeader transferEncodingHeader = null;
        if (transferEncoding != null) {
            transferEncodingHeader = (TransferEncodingHttpHeader) transferEncoding;
        }

        String contentType = contentTypeHeader.getMediaType().getType();
        Charset charset = contentTypeHeader.getMediaType().getCharset();

        if (transferEncodingHeader == null || transferEncodingHeader.getValue() == null) {
            return null;
        } else {
            if (transferEncodingHeader.getValue().compareTo("chunked") == 0) {
                return readChunked(is, headers);
            } else {
                throw new HttpException(HttpStatusCode.STATUS_501_NOT_IMPLEMENTED,
                        String.format("The Transfer-Encoding '%1s' is not supported.", transferEncoding));
            }
View Full Code Here

TOP

Related Classes of com.ramforth.webserver.http.headers.general.TransferEncodingHttpHeader

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.