Package org.eclipse.jetty.util

Examples of org.eclipse.jetty.util.Fields


            {
                resetLatch.countDown();
            }
        });

        Fields headers = SPDYTestUtils.createHeaders("localhost", proxyAddress.getPort(), version, "GET", "/");
        headers.put("connection", "close");

        client.syn(new SynInfo(headers, true), new StreamFrameListener.Adapter()
        {
            @Override
            public void onReply(Stream stream, ReplyInfo replyInfo)
View Full Code Here


        }), 30000, 30000);

        final CountDownLatch replyLatch = new CountDownLatch(1);

        Session client = factory.newSPDYClient(version).connect(proxyAddress, null);
        Fields headers = SPDYTestUtils.createHeaders("localhost", proxyAddress.getPort(), version, "GET", "/");

        client.syn(new SynInfo(headers, true), new StreamFrameListener.Adapter()
        {
            @Override
            public void onReply(Stream stream, ReplyInfo replyInfo)
View Full Code Here

        Session client = factory.newSPDYClient(version).connect(proxyAddress, null);

        final CountDownLatch replyLatch = new CountDownLatch(1);
        final CountDownLatch dataLatch = new CountDownLatch(1);

        Fields headers = SPDYTestUtils.createHeaders("localhost", proxyAddress.getPort(), version, "POST", "/");
        headers.put(header, "bar");
        headers.put("connection", "close");

        Stream stream = client.syn(new SynInfo(headers, false), new StreamFrameListener.Adapter()
        {
            private final ByteArrayOutputStream result = new ByteArrayOutputStream();

            @Override
            public void onReply(Stream stream, ReplyInfo replyInfo)
            {
                Fields headers = replyInfo.getHeaders();
                assertThat("custom header exists in response", headers.get(header), is(notNullValue()));
                replyLatch.countDown();
            }

            @Override
            public void onData(Stream stream, DataInfo dataInfo)
View Full Code Here

        Session client = factory.newSPDYClient(version).connect(proxyAddress, null);

        final CountDownLatch replyLatch = new CountDownLatch(1);
        final CountDownLatch dataLatch = new CountDownLatch(1);

        Fields headers = SPDYTestUtils.createHeaders("localhost", proxyAddress.getPort(), version, "POST", "/");
        headers.put(header, "bar");
        headers.put("connection", "close");

        Stream stream = client.syn(new SynInfo(headers, false), new StreamFrameListener.Adapter()
        {
            private final ByteArrayOutputStream result = new ByteArrayOutputStream();

            @Override
            public void onReply(Stream stream, ReplyInfo replyInfo)
            {
                Fields headers = replyInfo.getHeaders();
                assertThat("custom header exists in response", headers.get(header), is(notNullValue()));
                replyLatch.countDown();
            }

            @Override
            public void onData(Stream stream, DataInfo dataInfo)
View Full Code Here

            {
                goAwayLatch.countDown();
            }
        });

        Fields headers = SPDYTestUtils.createHeaders("localhost", proxyAddress.getPort(), version, "POST", "/");
        ((StdErrLog)Log.getLogger(HttpChannel.class)).setHideStacks(true);
        client.syn(new SynInfo(headers, false), null);
        assertThat("goAway has been received by proxy", goAwayLatch.await(2 * timeout, TimeUnit.MILLISECONDS),
                is(true));
    }
View Full Code Here

        Session client = factory.newSPDYClient(version).connect(proxyAddress, null);

        final CountDownLatch replyLatch = new CountDownLatch(1);

        Fields headers = SPDYTestUtils.createHeaders("localhost", proxyAddress.getPort(), version, "POST", "/");
        headers.put(header, "bar");
        headers.put("connection", "close");

        client.syn(new SynInfo(headers, true), new StreamFrameListener.Adapter()
        {
            @Override
            public void onReply(Stream stream, ReplyInfo replyInfo)
            {
                Fields headers = replyInfo.getHeaders();
                assertThat("status is 504", headers.get(HTTPSPDYHeader.STATUS.name(version)).getValue(), is("504"));
                replyLatch.countDown();
            }

        });
View Full Code Here

        final String uuid = UUID.randomUUID().toString();

        final CountDownLatch replyLatch = new CountDownLatch(1);
        final CountDownLatch dataLatch = new CountDownLatch(1);

        Fields headers = SPDYTestUtils.createHeaders(serverHost, proxyAddress.getPort(), version, "POST", "/");
        headers.add(UUID_HEADER_NAME, uuid);

        Stream stream = client.syn(new SynInfo(headers, false), new StreamFrameListener.Adapter()
        {
            private final ByteArrayOutputStream result = new ByteArrayOutputStream();

            @Override
            public void onReply(Stream stream, ReplyInfo replyInfo)
            {
                Fields headers = replyInfo.getHeaders();
                assertThat("uuid matches expected uuid", headers.get(UUID_HEADER_NAME).getValue(), is(uuid));
                assertThat("response comes from the given server", headers.get(SERVER_ID_HEADER).getValue(),
                        is(serverIdentificationString));
                replyLatch.countDown();
            }

            @Override
View Full Code Here

        }

        @Override
        public StreamFrameListener onSyn(Stream stream, SynInfo synInfo)
        {
            Fields requestHeaders = synInfo.getHeaders();
            Assert.assertNotNull(requestHeaders.get("via"));
            Fields.Field uuidHeader = requestHeaders.get(UUID_HEADER_NAME);
            Assert.assertNotNull(uuidHeader);

            Fields responseHeaders = new Fields();
            responseHeaders.put(UUID_HEADER_NAME, uuidHeader.getValue());
            responseHeaders.put(SERVER_ID_HEADER, serverId);
            stream.reply(new ReplyInfo(responseHeaders, false), new Callback.Adapter());
            return new StreamFrameListener.Adapter()
            {
                @Override
                public void onData(Stream stream, DataInfo dataInfo)
View Full Code Here

        }

        @Override
        public void reply(ReplyInfo replyInfo, final Callback handler)
        {
            Fields headers = new Fields(replyInfo.getHeaders(), false);

                addPersistenceHeader(headers);

            headers.remove(HTTPSPDYHeader.SCHEME.name(version));

            String status = headers.remove(HTTPSPDYHeader.STATUS.name(version)).getValue();
            Matcher matcher = statusRegexp.matcher(status);
            matcher.matches();
            int code = Integer.parseInt(matcher.group(1));
            String reason = matcher.group(2).trim();

            HttpVersion httpVersion = HttpVersion.fromString(headers.remove(HTTPSPDYHeader.VERSION.name(version)).getValue());

            // Convert the Host header from a SPDY special header to a normal header
            Fields.Field host = headers.remove(HTTPSPDYHeader.HOST.name(version));
            if (host != null)
                headers.put("host", host.getValue());

            HttpFields fields = new HttpFields();
            for (Fields.Field header : headers)
            {
                String name = camelize(header.getName());
View Full Code Here

    {
        short version = clientStream.getSession().getVersion();
        String method = clientSynInfo.getHeaders().get(HTTPSPDYHeader.METHOD.name(version)).getValue();
        String path = clientSynInfo.getHeaders().get(HTTPSPDYHeader.URI.name(version)).getValue();

        Fields headers = new Fields(clientSynInfo.getHeaders(), false);

        removeHopHeaders(headers);
        addRequestProxyHeaders(clientStream, headers);
        customizeRequestHeaders(clientStream, headers);
View Full Code Here

TOP

Related Classes of org.eclipse.jetty.util.Fields

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.