Package org.eclipse.jetty.http

Examples of org.eclipse.jetty.http.HttpMethod


            // else onCompletion will handle it.
        }
    }

    private Timer requestTimer(String method) {
        final HttpMethod m = HttpMethod.fromString(method);
        if (m == null) {
            return otherRequests;
        } else {
            switch (m) {
                case GET:
View Full Code Here


            // else onCompletion will handle it.
        }
    }

    private Timer requestTimer(String method) {
        final HttpMethod m = HttpMethod.fromString(method);
        if (m == null) {
            return otherRequests;
        } else {
            switch (m) {
                case GET:
View Full Code Here

        {
            onBadMessage(400, "Missing required request line elements");
            return false;
        }

        HttpMethod httpMethod = HttpMethod.fromString(methodHeader.getValue());
        HttpVersion httpVersion = HttpVersion.fromString(versionHeader.getValue());


        if (LOG.isDebugEnabled())
            LOG.debug("HTTP > {} {} {}", httpMethod, uriHeader.getValue(), httpVersion);


        HostPortHttpField hostPort = null;
        HttpFields fields = new HttpFields();
        for (Fields.Field header : headers)
        {
            String name = header.getName();

            // Skip special SPDY headers, unless it's the "host" header
            HTTPSPDYHeader specialHeader = HTTPSPDYHeader.from(stream.getSession().getVersion(), name);
            if (specialHeader != null)
            {
                if (specialHeader != HTTPSPDYHeader.HOST)
                    continue;
                name = "host";
            }

            switch (name)
            {
                case "connection":
                case "keep-alive":
                case "proxy-connection":
                case "transfer-encoding":
                {
                    // Spec says to ignore these headers.
                    break;
                }
                case "host":
                {
                    hostPort = new HostPortHttpField(header.getValue());
                    break;
                }
                default:
                {
                    // Spec says headers must be single valued
                    String value = header.getValue();
                    if (LOG.isDebugEnabled())
                        LOG.debug("HTTP > {}: {}", name, value);
                    fields.add(new HttpField(name, value));
                    break;
                }
            }
        }

        if (hostPort == null)
        {
            onBadMessage(400, "Missing Host header");
            return false;
        }

        // At last, add the Host header.
        if (hostPort!=null)
            fields.add(hostPort);

        Fields.Field schemeHeader = headers.get(HTTPSPDYHeader.SCHEME.name(version));
       
        HttpURI uri = new HttpURI(uriHeader.getValue());
        if (uri.getScheme()==null && schemeHeader!=null)
            uri.setScheme(schemeHeader.getValue());
        if (uri.getHost()==null && hostPort!=null)
            uri.setAuthority(hostPort.getHost(),hostPort.getPort());
       
        MetaData.Request request = new MetaData.Request(httpMethod==null?methodHeader.getValue():httpMethod.asString(), uri, httpVersion, fields);
        onRequest(request);
        return true;
    }
View Full Code Here

    private void test(Random random, final CountDownLatch latch, final List<String> failures) throws InterruptedException
    {
        // Choose a random destination
        String host = random.nextBoolean() ? "localhost" : "127.0.0.1";
        // Choose a random method
        HttpMethod method = random.nextBoolean() ? HttpMethod.GET : HttpMethod.POST;

        boolean ssl = HttpScheme.HTTPS.is(scheme);

        // Choose randomly whether to close the connection on the client or on the server
        boolean clientClose = false;
        if (!ssl && random.nextBoolean())
            clientClose = true;
        boolean serverClose = false;
        if (!ssl && random.nextBoolean())
            serverClose = true;

        int maxContentLength = 64 * 1024;
        int contentLength = random.nextInt(maxContentLength) + 1;

        test(scheme, host, method.asString(), clientClose, serverClose, contentLength, true, latch, failures);
    }
View Full Code Here

            return new ByteArrayInputStream(response.getContent());
        }
    }

    private Request translateRequest(final ClientRequest clientRequest) {
        final HttpMethod method = HttpMethod.fromString(clientRequest.getMethod());
        if (method == null) {
            throw new ProcessingException(LocalizationMessages.METHOD_NOT_SUPPORTED(clientRequest.getMethod()));
        }
        final URI uri = clientRequest.getUri();
        final Request request = client.newRequest(uri);
View Full Code Here

            // else onCompletion will handle it.
        }
    }

    private Timer requestTimer(String method) {
        final HttpMethod m = HttpMethod.fromString(method);
        if (m == null) {
            return otherRequests;
        } else {
            switch (m) {
                case GET:
View Full Code Here

            // else onCompletion will handle it.
        }
    }

    private Timer requestTimer(String method) {
        final HttpMethod m = HttpMethod.fromString(method);
        if (m == null) {
            return otherRequests;
        } else {
            switch (m) {
                case GET:
View Full Code Here

            // else onCompletion will handle it.
        }
    }

    private Timer requestTimer(String method) {
        final HttpMethod m = HttpMethod.fromString(method);
        if (m == null) {
            return otherRequests;
        } else {
            switch (m) {
                case GET:
View Full Code Here

            // else onCompletion will handle it.
        }
    }

    private Timer requestTimer(String method) {
        final HttpMethod m = HttpMethod.fromString(method);
        if (m == null) {
            return otherRequests;
        } else {
            switch (m) {
                case GET:
View Full Code Here

            // else onCompletion will handle it.
        }
    }

    private Timer requestTimer(String method) {
        final HttpMethod m = HttpMethod.fromString(method);
        if (m == null) {
            return otherRequests;
        } else {
            switch (m) {
                case GET:
View Full Code Here

TOP

Related Classes of org.eclipse.jetty.http.HttpMethod

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.