Examples of CBuffer


Examples of org.apache.tomcat.lite.io.CBuffer

        serializeHeaders(res.getMimeHeaders(), rawSendBuffers2);
    }

    public static void serializeHeaders(MultiMap mimeHeaders, IOBuffer rawSendBuffers2) throws IOException {
        for (int i = 0; i < mimeHeaders.size(); i++) {
            CBuffer name = mimeHeaders.getName(i);
            CBuffer value = mimeHeaders.getValue(i);
            if (name.length() == 0 || value.length() == 0) {
                continue;
            }
            rawSendBuffers2.append(name);
            rawSendBuffers2.append(Http11Connection.COLON);
            rawSendBuffers2.append(value);
View Full Code Here

Examples of org.apache.tomcat.lite.io.CBuffer

                int pos = find(contexts, uri);
                if (pos >= 0) {
                    int lastSlash = -1;
                    int length = -1;
                    boolean found = false;
                    CBuffer tmp = mappingData.tmpPrefix;
                    tmp.wrap(uri, 0, uri.length());

                    while (pos >= 0) {
                        if (tmp.startsWith(contexts[pos].name)) {
                            length = contexts[pos].name.length();
                            if (tmp.length() == length) {
                                found = true;
                                break;
                            } else if (tmp.startsWithIgnoreCase("/", length)) {
                                found = true;
                                break;
                            }
                        }
                        if (lastSlash == -1) {
                            lastSlash = tmp.nthSlash(nesting + 1);
                        } else {
                            lastSlash = tmp.lastIndexOf('/');
                        }
                        tmp.delete(lastSlash);
                        pos = find(contexts, tmp);
                    }

                    if (!found) {
                        if (contexts[0].name.equals("")) {
View Full Code Here

Examples of org.apache.tomcat.lite.io.CBuffer

            }
            if (checkWelcomeFiles) {
                for (int i = 0; (i < context.welcomeResources.length)
                         && (mappingData.getServiceObject() == null); i++) {

                    CBuffer wpath = mappingData.tmpWelcome;
                    wpath.set(urlNoContext);
                    wpath.append(context.welcomeResources[i]);

                    // Rule 4a -- Welcome resources processing for exact macth
                    internalMapExactWrapper(exactWrappers, urlNoContext, mappingData);

                    // Rule 4b -- Welcome resources processing for prefix match
View Full Code Here

Examples of org.apache.tomcat.lite.io.CBuffer

         MappingData mappingData) {

        int lastSlash = -1;
        int length = -1;

        CBuffer tmp = mappingData.tmpPrefix;
        tmp.wrap(path, 0, path.length());

        int pos = find(wrappers, tmp);
        if (pos != -1) {
            boolean found = false;
            while (pos >= 0) {
                if (tmp.startsWith(wrappers[pos].name)) {
                    length = wrappers[pos].name.length();
                    if (tmp.length() == length) {
                        found = true;
                        break;
                    } else if (tmp.startsWithIgnoreCase("/", length)) {
                        found = true;
                        break;
                    }
                }
                if (lastSlash == -1) {
                    lastSlash = tmp.nthSlash(nesting + 1);
                } else {
                    lastSlash = tmp.lastIndexOf('/');
                }
                tmp.delete(lastSlash);
                pos = find(wrappers, tmp);
            }
            if (found) {
                mappingData.wrapperPath.set(wrappers[pos].name);
View Full Code Here

Examples of org.apache.tomcat.lite.io.CBuffer

    public String getContextPath() {
        return (getMappingData().contextPath.toString());
    }

    public String getPathInfo() {
        CBuffer pathInfo = getMappingData().pathInfo;
        if (pathInfo.length() == 0) {
            return null;
        }
        return (getMappingData().pathInfo.toString());
    }
View Full Code Here

Examples of org.apache.tomcat.lite.io.CBuffer

    public CBuffer requestURI() {
        return requestURI;
    }

    public CBuffer requestURL() {
        CBuffer url = requestURL;
        url.recycle();

        String scheme = getScheme();
        int port = getServerPort();
        if (port < 0)
            port = 80; // Work around java.net.URL bug

        url.append(scheme);
        url.append("://");
        url.append(getServerName());
        if ((scheme.equals("http") && (port != 80))
            || (scheme.equals("https") && (port != 443))) {
            url.append(':');
            url.append(port);
        }
        // Decoded !!
        url.append(getRequestURI());

        return (url);

    }
View Full Code Here

Examples of org.apache.tomcat.lite.io.CBuffer

    public void setRequestURI(String encodedUri) {
        requestURI.set(encodedUri);
    }

    CBuffer getOrAdd(String name) {
        CBuffer header = getMimeHeaders().getHeader(name);
        if (header == null) {
            header = getMimeHeaders().addValue(name);
        }
        return header;
    }
View Full Code Here

Examples of org.apache.tomcat.lite.io.CBuffer

        if (enc != null) {
            result = bc.toString(enc);
        } else {
            // Ascii

            CBuffer cc = tmpNameC;
            cc.recycle();
            int length = bc.getLength();
            byte[] bbuf = bc.array();
            int start = bc.getStart();
            cc.appendAscii(bbuf, start, length);
            result = cc.toString();
            cc.recycle();
        }
        return result;
    }
View Full Code Here

Examples of org.apache.tomcat.lite.io.CBuffer

        out.putByte(0x80);
        out.putByte(0x01);
        out.putByte(0x00);
        out.putByte(0x01);

        CBuffer method = http.getRequest().method();
        if (method.equals("GET") || method.equals("HEAD")) {
            http.getOut().close();
        }

        if (http.getOut().isAppendClosed()) {
            out.putByte(0x01); // closed
View Full Code Here

Examples of org.apache.tomcat.lite.io.CBuffer

    private BBuffer serializeMime(MultiMap mimeHeaders, BBuffer headBuf)
            throws IOException {

        // TODO: duplicated headers not allowed
        for (int i = 0; i < mimeHeaders.size(); i++) {
            CBuffer name = mimeHeaders.getName(i);
            CBuffer value = mimeHeaders.getValue(i);
            if (name.length() == 0 || value.length() == 0) {
                continue;
            }
            SpdyConnection.appendShort(headBuf, name.length());
            name.toAscii(headBuf);
            SpdyConnection.appendShort(headBuf, value.length());
            value.toAscii(headBuf);
        }
        return headBuf;
    }
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.