Examples of HttpVersion


Examples of org.apache.commons.httpclient.HttpVersion

        public boolean process(final SimpleRequest request, final SimpleResponse response)
            throws IOException
        {
            String uri = request.getRequestLine().getUri()
            HttpVersion httpversion = request.getRequestLine().getHttpVersion();
           
            if ("/miss/".equals(uri)) {
                response.setStatusLine(httpversion, HttpStatus.SC_MOVED_TEMPORARILY);
                response.addHeader(new Header("Location", "/hit/"));
                response.setBodyString("Missed!");
View Full Code Here

Examples of org.apache.commons.httpclient.HttpVersion

        public boolean process(final SimpleRequest request, final SimpleResponse response)
            throws IOException
        {
            RequestLine requestLine = request.getRequestLine();
            HttpVersion ver = requestLine.getHttpVersion();
            Header auth = request.getFirstHeader("Authorization");
            if (auth == null) {
                response.setStatusLine(ver, HttpStatus.SC_UNAUTHORIZED);
                response.addHeader(new Header("WWW-Authenticate", "NTLM"));
                response.setBodyString("Authorization required");
View Full Code Here

Examples of org.apache.commons.httpclient.HttpVersion

        public boolean process(final SimpleRequest request, final SimpleResponse response)
            throws IOException
        {
            RequestLine requestLine = request.getRequestLine();
            HttpVersion ver = requestLine.getHttpVersion();
            Header auth = request.getFirstHeader("Authorization");
            if (auth == null) {
                response.setStatusLine(ver, HttpStatus.SC_UNAUTHORIZED);
                response.addHeader(new Header("WWW-Authenticate",
                        "Digest realm=\"realm1\", nonce=\"ABC123\""));
View Full Code Here

Examples of org.apache.commons.httpclient.HttpVersion

        }

        public boolean process(final SimpleRequest request, final SimpleResponse response)
            throws IOException
        {
            HttpVersion ver = request.getRequestLine().getHttpVersion();
            response.setStatusLine(ver, HttpStatus.SC_OK);
            response.addHeader(new Header("Connection", "close"));
            response.addHeader(new Header("Set-Cookie",
                "custno = 12345; comment=test; version=1," +
                " name=John; version=1; max-age=600; secure; domain=.apache.org"));
View Full Code Here

Examples of org.apache.commons.httpclient.HttpVersion

        public boolean process(final SimpleRequest request, final SimpleResponse response)
            throws IOException
        {
            RequestLine requestLine = request.getRequestLine();
            HttpVersion ver = requestLine.getHttpVersion();
            Header auth = request.getFirstHeader("Authorization");
            if (auth == null) {
                response.setStatusLine(ver, HttpStatus.SC_UNAUTHORIZED);
                response.addHeader(new Header("WWW-Authenticate",
                        "Digest realm=\"realm1\", nonce=\"ABC123\""));
View Full Code Here

Examples of org.apache.commons.httpclient.HttpVersion

    protected void doSetUp() throws Exception
    {
        super.doSetUp();

        _resp = new HttpResponse();
        _resp.setStatusLine(new HttpVersion(1, 1), 200);
        _resp.setHeader(new Header(HttpConstants.HEADER_CONTENT_TYPE, HttpConstants.DEFAULT_CONTENT_TYPE));
        _resp.setBody(new DefaultMuleMessage(_body, muleContext));
    }
View Full Code Here

Examples of org.apache.commons.httpclient.HttpVersion

    @Override
    protected void addProperties(DefaultMuleMessage message, Object transportMessage) throws Exception
    {
        String method;
        HttpVersion httpVersion;
        String uri;
        String statusCode = null;
        Map<String, Object> headers;

        if (transportMessage instanceof HttpRequest)
        {
            HttpRequest httpRequest = (HttpRequest) transportMessage;
            method = httpRequest.getRequestLine().getMethod();
            httpVersion = httpRequest.getRequestLine().getHttpVersion();
            uri = httpRequest.getRequestLine().getUri();
            headers = convertHeadersToMap(httpRequest.getHeaders(), uri);
            convertMultiPartHeaders(headers);
        }
        else if (transportMessage instanceof HttpMethod)
        {
            HttpMethod httpMethod = (HttpMethod) transportMessage;
            method = httpMethod.getName();
            httpVersion = HttpVersion.parse(httpMethod.getStatusLine().getHttpVersion());
            uri = httpMethod.getURI().toString();
            statusCode = String.valueOf(httpMethod.getStatusCode());
            headers = convertHeadersToMap(httpMethod.getResponseHeaders(), uri);
        }
        else
        {
            // This should never happen because of the supported type checking in our superclass
            throw new MessageTypeNotSupportedException(transportMessage, getClass());
        }

        rewriteConnectionAndKeepAliveHeaders(headers);

        headers = processIncomingHeaders(headers);

        //Make any URI params available ans inbound message headers
        addUriParamsAsHeaders(headers, uri);

        headers.put(HttpConnector.HTTP_METHOD_PROPERTY, method);
        headers.put(HttpConnector.HTTP_REQUEST_PROPERTY, uri);
        headers.put(HttpConnector.HTTP_VERSION_PROPERTY, httpVersion.toString());
        if (enableCookies)
        {
            headers.put(HttpConnector.HTTP_COOKIE_SPEC_PROPERTY, cookieSpec);
        }
View Full Code Here

Examples of org.apache.commons.httpclient.HttpVersion

           
            // respond with status code 100, for Expect handshake
            // according to rfc 2616 and http 1.1
            // the processing will continue and the request will be fully
            // read immediately after
            HttpVersion requestVersion = requestLine.getHttpVersion();
            if (HttpVersion.HTTP_1_1.equals(requestVersion))
            {
                Header expectHeader = request.getFirstHeader(HttpConstants.HEADER_EXPECT);
                if (expectHeader != null)
                {
View Full Code Here

Examples of org.apache.http.HttpVersion

        assertTrue(reuseStrategy.keepAlive(response, context));
    }

    public void testFutureHTTP() throws Exception {
        HttpResponse response =
            createResponse(new HttpVersion(3, 45), 200, "OK");

        assertTrue(reuseStrategy.keepAlive(response, context));
    }
View Full Code Here

Examples of org.apache.http.HttpVersion

    }

    public void testHttpVersionParsing() throws Exception {

        String s = "HTTP/1.1";
        HttpVersion version = (HttpVersion)
            BasicLineParser.parseProtocolVersion(s, null);
        assertEquals("HTTP protocol name", "HTTP", version.getProtocol());
        assertEquals("HTTP major version number", 1, version.getMajor());
        assertEquals("HTTP minor version number", 1, version.getMinor());
        assertEquals("HTTP version number", s, version.toString());

        s = "HTTP/123.4567";
        version = (HttpVersion)
            BasicLineParser.parseProtocolVersion(s, null);
        assertEquals("HTTP protocol name", "HTTP", version.getProtocol());
        assertEquals("HTTP major version number", 123, version.getMajor());
        assertEquals("HTTP minor version number", 4567, version.getMinor());
        assertEquals("HTTP version number", s, version.toString());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.