Package org.eclipse.jetty.http

Examples of org.eclipse.jetty.http.HttpField$IntValueHttpField


        // remove any existing set-cookie fields of same name
        Iterator<HttpField> i=_fields.iterator();
        while (i.hasNext())
        {
            HttpField field=i.next();
            if (field.getHeader()==HttpHeader.SET_COOKIE)
            {
                String val = field.getValue();
                if (val!=null && val.startsWith(name_equals))
                {
                    //existing cookie has same name, does it also match domain and path?
                    if (((!has_domain && !val.contains("Domain")) || (has_domain && val.contains(domain))) &&
                        ((!has_path && !val.contains("Path")) || (has_path && val.contains(path))))
View Full Code Here


    }

    public void putHeaders(HttpContent content,long contentLength, boolean etag)
    {
       
        HttpField lm = content.getLastModified();
        if (lm!=null)
            _fields.put(lm);

        if (contentLength==0)
        {
            _fields.put(content.getContentLength());
            _contentLength=content.getContentLengthValue();
        }
        else if (contentLength>0)
        {
            _fields.putLongField(HttpHeader.CONTENT_LENGTH,contentLength);
            _contentLength=contentLength;
        }

        HttpField ct=content.getContentType();
        if (ct!=null)
        {
            _fields.put(ct);
            _contentType=ct.getValue();
            _characterEncoding=content.getCharacterEncoding();
            _mimeType=content.getMimeType();
        }
       
        if (etag)
        {
            HttpField et = content.getETag();
            if (et!=null)
                _fields.put(et);
        }
    }
View Full Code Here

    {
        final Request request = exchange.getRequest();
        final long idleTimeout = request.getIdleTimeout();
        short spdyVersion = getHttpChannel().getSession().getVersion();
        Fields fields = new Fields();
        HttpField hostHeader = null;
        for (HttpField header : request.getHeaders())
        {
            String name = header.getName();
            // The host header needs a special treatment
            if (HTTPSPDYHeader.from(spdyVersion, name) != HTTPSPDYHeader.HOST)
                fields.add(name, header.getValue());
            else
                hostHeader = header;
        }

        // Add special SPDY headers
        fields.put(HTTPSPDYHeader.METHOD.name(spdyVersion), request.getMethod());
        String path = request.getPath();
        String query = request.getQuery();
        if (query != null)
            path += "?" + query;
        fields.put(HTTPSPDYHeader.URI.name(spdyVersion), path);
        fields.put(HTTPSPDYHeader.VERSION.name(spdyVersion), request.getVersion().asString());
        if (hostHeader != null)
            fields.put(HTTPSPDYHeader.HOST.name(spdyVersion), hostHeader.getValue());

        SynInfo synInfo = new SynInfo(fields, !content.hasContent());
        getHttpChannel().getSession().syn(synInfo, getHttpChannel().getHttpReceiver(), new Promise<Stream>()
        {
            @Override
View Full Code Here

        }
       
        Entry(int index,String name, String value)
        {   
            _slot=index;
            _field=new HttpField(name,value);
        }
View Full Code Here

                    value=Huffman.decode(buffer,length);
                else
                    value=toASCIIString(buffer,length);

                // Make the new field
                HttpField field;
                if (header==null)
                {
                    // just make a normal field and bypass header name lookup
                    field = new HttpField(null,name,value);
                }
                else
                {
                    // might be worthwhile to create a value HttpField if it is indexed
                    // and/or of a type that may be looked up multiple times.
                    switch(header)
                    {
                        case C_STATUS:
                            if (indexed)
                                field = new HttpField.IntValueHttpField(header,name,value);
                            else
                                field = new HttpField(header,name,value);
                            break;

                        case C_AUTHORITY:
                            field = new AuthorityHttpField(value);
                            break;

                        case CONTENT_LENGTH:
                            if ("0".equals(value))
                                field = CONTENT_LENGTH_0;
                            else
                                field = new HttpField.LongValueHttpField(header,name,value);
                            break;

                        default:
                            field = new HttpField(header,name,value);
                            break;
                    }
                }

                if (LOG.isDebugEnabled())
View Full Code Here

                {
                    String name = field.getName();
                    if (HTTPSPDYHeader.from(spdy, name) != null)
                        continue;
                    // TODO: handle multiple values properly
                    HttpField httpField = new HttpField(name, field.getValue());
                    responseHeader(exchange, httpField);
                }

                if (responseHeaders(exchange))
                {
View Full Code Here

        {
            MetaData.Request request = (MetaData.Request)metadata;

            // TODO optimise these to avoid HttpField creation
            String scheme=request.getURI().getScheme();
            encode(buffer,new HttpField(HttpHeader.C_SCHEME,scheme==null?HttpScheme.HTTP.asString():scheme));
            encode(buffer,new HttpField(HttpHeader.C_METHOD,request.getMethod()));
            encode(buffer,new HttpField(HttpHeader.C_AUTHORITY,request.getURI().getAuthority()));
            encode(buffer,new HttpField(HttpHeader.C_PATH,request.getURI().getPathQuery()));

        }
        else if (metadata.isResponse())
        {
            MetaData.Response response = (MetaData.Response)metadata;
            int code=response.getStatus();
            HttpField status = code<__status.length?__status[code]:null;
            if (status==null)
                status=new HttpField.IntValueHttpField(HttpHeader.C_STATUS,code);
            encode(buffer,status);
        }
View Full Code Here

        // remove any existing set-cookie fields of same name
        Iterator<HttpField> i=_fields.iterator();
        while (i.hasNext())
        {
            HttpField field=i.next();
            if (field.getHeader()==HttpHeader.SET_COOKIE)
            {
                String val = field.getValue();
                if (val!=null && val.startsWith(name_equals))
                {
                    //existing cookie has same name, does it also match domain and path?
                    if (((!has_domain && !val.contains("Domain")) || (has_domain && val.contains(domain))) &&
                        ((!has_path && !val.contains("Path")) || (has_path && val.contains(path))))
View Full Code Here

        // remove any existing set-cookie fields of same name
        Iterator<HttpField> i=_fields.iterator();
        while (i.hasNext())
        {
            HttpField field=i.next();
            if (field.getHeader()==HttpHeader.SET_COOKIE)
            {
                String val = field.getValue();
                if (val!=null && val.startsWith(name_equals))
                {
                    //existing cookie has same name, does it also match domain and path?
                    if (((!has_domain && !val.contains("Domain")) || (has_domain && val.contains(domain))) &&
                        ((!has_path && !val.contains("Path")) || (has_path && val.contains(path))))
View Full Code Here

        path = uri.getRawPath();
        query = uri.getRawQuery();
        extractParams(query);
        followRedirects(client.isFollowRedirects());
        idleTimeout = client.getIdleTimeout();
        HttpField acceptEncodingField = client.getAcceptEncodingField();
        if (acceptEncodingField != null)
            headers.put(acceptEncodingField);
    }
View Full Code Here

TOP

Related Classes of org.eclipse.jetty.http.HttpField$IntValueHttpField

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.