Package com.ramforth.webserver.http

Examples of com.ramforth.webserver.http.IHttpHeaders


    private final IHttpHeaderFactory httpHeaderFactory = new HttpHeaderFactory();

    @Override
    public IHttpHeaders parse(InputStream is) {
        IHttpHeaders httpHeaders = new HttpHeaders();

        IHttpHeader header;
        while ((header = parseHeader(is)) != null) {
            httpHeaders.addHeader(header);
        }

        return httpHeaders;
    }
View Full Code Here


                LOGGER.error("Tried to read the two consecutive characters after inter boundary separator. Could have been either CRLF or DASHDASH.", ioex);
                throw new HttpException(HttpStatusCode.STATUS_400_BAD_REQUEST, ioex.getMessage());
            }

            IHttpHeadersParser headersParser = new HttpHeadersParser();
            IHttpHeaders headers = headersParser.parse(inputStream);

            ContentDispositionHttpHeader partContentDisposition = (ContentDispositionHttpHeader) headers.getHeader("Content-Disposition");
            if (partContentDisposition == null
                    || !partContentDisposition.getDispositionType().getType().equalsIgnoreCase("form-data")
                    || !partContentDisposition.getDispositionType().getParameters().containsName("name")) {
                throw new HttpException(HttpStatusCode.STATUS_400_BAD_REQUEST,
                        String.format("Bad Content-Disposition: %s.", partContentDisposition.getRawValue()));
            }

            ContentTypeHttpHeader partContentType = (ContentTypeHttpHeader) headers.getHeader("Content-Type");
            BoundaryDelimitedInputStream bdis = new BoundaryDelimitedInputStream(inputStream, boundary);

            IHttpRequestBodyParserFactory bodyParserFactory = new HttpRequestBodyParserFactory();
            IHttpRequestBodyParser partBodyParser = bodyParserFactory.build(partContentType, partContentDisposition);
View Full Code Here

       
        httpContext.getResponse().setStatusCode(new HttpStatusCode(HttpStatusCodeClass.SUCCESS, 200, ""));
        httpContext.getResponse().setConnectionType(ConnectionType.CLOSE);
       
        HttpHeadersParser httpHeadersParser = new HttpHeadersParser();
        IHttpHeaders responseHeaders = httpHeadersParser.parse(cgiProcess.getInputStream());
        for (IHttpHeader responseHeader : responseHeaders) {
            httpContext.getResponse().getHeaders().addHeader(responseHeader);
        }

        IHttpResponseWriter httpResponseWriter = new HttpResponseWriter(httpContext.getResponse().getOutputStream());
View Full Code Here

TOP

Related Classes of com.ramforth.webserver.http.IHttpHeaders

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.