Examples of DataChunk


Examples of org.glassfish.grizzly.http.util.DataChunk

        @Override
        public String resolve(final Request request) {
            try {
                final RequestURIRef uriRef = request.getRequest().getRequestURIRef();
                uriRef.setDefaultURIEncoding(httpHandler.getRequestURIEncoding());
                final DataChunk decodedURI = uriRef.getDecodedRequestURIBC(
                        httpHandler.isAllowEncodedSlash());
               
                final int pos = decodedURI.indexOf(';', 0);
                return pos < 0 ? decodedURI.toString() : decodedURI.toString(0, pos);
            } catch (CharConversionException e) {
                throw new IllegalStateException(e);
            }
        }
View Full Code Here

Examples of org.glassfish.grizzly.http.util.DataChunk

            return false;
        }       
        final FileCacheKey other = (FileCacheKey) obj;
       
        final String otherHost = other.host;
        final DataChunk hostDC = getHostLazy();
        if ((hostDC == null || hostDC.isNull()) ? (otherHost != null) : !hostDC.equals(otherHost)) {
            return false;
        }

        final String otherUri = other.uri;
        final DataChunk uriDC = getUriLazy();
        if ((uriDC == null || uriDC.isNull()) ? (otherUri != null) : !uriDC.equals(otherUri)) {
            return false;
        }
        return true;
    }
View Full Code Here

Examples of org.glassfish.grizzly.http.util.DataChunk

    @Override
    public int hashCode() {
        if (hashCode == 0) {
            int hash = 3;
            final DataChunk hostDC = getHostLazy();
            final DataChunk uriDC = getUriLazy();
       
            hash = 23 * hash + (hostDC != null ? hostDC.hashCode() : 0);
            hash = 23 * hash + (uriDC != null ? uriDC.hashCode() : 0);
            hashCode = hash;
        }
        return hashCode;
    }
View Full Code Here

Examples of org.glassfish.grizzly.http.util.DataChunk

        if (semicolonPos == 0) {
            semicolonPos = decodedURI.indexOf(';', 0);
        }

        DataChunk localDecodedURI = decodedURI;
        if (semicolonPos >= 0) {
            charChunk.setEnd(semicolonPos);
            // duplicate the URI path, because Mapper may corrupt the attributes,
            // which follow the path
            localDecodedURI = mappingData.tmpMapperDC;
            localDecodedURI.duplicate(decodedURI);
        }


        map(requestPacket, localDecodedURI, mappingData);
        charChunk.setEnd(oldEnd);
View Full Code Here

Examples of org.glassfish.grizzly.http.util.DataChunk

        if (semicolonPos == 0) {
            semicolonPos = decodedURI.indexOf(';', 0);
        }

        DataChunk localDecodedURI = decodedURI;
        if (semicolonPos >= 0) {
            charChunk.setEnd(semicolonPos);
            // duplicate the URI path, because Mapper may corrupt the attributes,
            // which follow the path
            localDecodedURI = mappingData.tmpMapperDC;
            localDecodedURI.duplicate(decodedURI);
        }


        map(serverName, localDecodedURI, mappingData);
        charChunk.setEnd(oldEnd);
View Full Code Here

Examples of org.glassfish.grizzly.http.util.DataChunk

    public void map(final HttpRequestPacket requestPacket, final DataChunk uri,
                    final MappingData mappingData) throws Exception {

        final CharChunk hostCC;
        if (hosts.length > 1) {
            final DataChunk host = requestPacket.serverName();
            if (host.isNull()) {
                host.getCharChunk().append(defaultHostName);
            } else if (host.getLength() == 0) {
                throw new Exception("Host is not set");
            } else {
                host.toChars(Constants.DEFAULT_HTTP_CHARSET);
            }
           
            hostCC = host.getCharChunk();
        } else {
            hostCC = null;
        }
       
        uri.toChars(Charsets.UTF8_CHARSET);
View Full Code Here

Examples of org.glassfish.grizzly.http.util.DataChunk

            // no more cookie headers headers
            if (pos < 0) {
                break;
            }

            DataChunk cookieValue = headers.getValue(pos);
            if (cookieValue == null || cookieValue.isNull()) {
                pos++;
                continue;
            }

            // Uncomment to test the new parsing code
            if (cookieValue.getType() == DataChunk.Type.Bytes) {
                if (logger.isLoggable(Level.FINE)) {
                    log("Parsing b[]: " + cookieValue.toString());
                }

                final ByteChunk byteChunk = cookieValue.getByteChunk();
                CookieParserUtils.parseClientCookies(this, byteChunk.getBuffer(),
                        byteChunk.getStart(),
                        byteChunk.getLength());
            } else if (cookieValue.getType() == DataChunk.Type.Buffer) {
                if (logger.isLoggable(Level.FINE)) {
                    log("Parsing buffer: " + cookieValue.toString());
                }

                final BufferChunk bufferChunk = cookieValue.getBufferChunk();
                CookieParserUtils.parseClientCookies(this, bufferChunk.getBuffer(),
                        bufferChunk.getStart(),
                        bufferChunk.getLength());
            } else {
                if (logger.isLoggable(Level.FINE)) {
                    log("Parsing string: " + cookieValue.toString());
                }

                final String value = cookieValue.toString();
                CookieParserUtils.parseClientCookies(this, value,
                        CookieUtils.COOKIE_VERSION_ONE_STRICT_COMPLIANCE,
                        CookieUtils.RFC_6265_SUPPORT_ENABLED);
            }
View Full Code Here

Examples of org.glassfish.grizzly.http.util.DataChunk

            // no more cookie headers headers
            if (pos < 0) {
                break;
            }

            DataChunk cookieValue = headers.getValue(pos);
            if (cookieValue == null || cookieValue.isNull()) {
                pos++;
                continue;
            }

            // Uncomment to test the new parsing code
            if (cookieValue.getType() == DataChunk.Type.Bytes) {
                if (logger.isLoggable(Level.FINE)) {
                    log("Parsing b[]: " + cookieValue.toString());
                }

                final ByteChunk byteChunk = cookieValue.getByteChunk();
                CookieParserUtils.parseServerCookies(this, byteChunk.getBuffer(),
                        byteChunk.getStart(),
                        byteChunk.getLength(),
                        CookieUtils.COOKIE_VERSION_ONE_STRICT_COMPLIANCE,
                        CookieUtils.RFC_6265_SUPPORT_ENABLED);
            } else if (cookieValue.getType() == DataChunk.Type.Buffer) {
                if (logger.isLoggable(Level.FINE)) {
                    log("Parsing b[]: " + cookieValue.toString());
                }

                final BufferChunk bufferChunk = cookieValue.getBufferChunk();
                CookieParserUtils.parseServerCookies(this, bufferChunk.getBuffer(),
                        bufferChunk.getStart(),
                        bufferChunk.getLength(),
                        CookieUtils.COOKIE_VERSION_ONE_STRICT_COMPLIANCE,
                        CookieUtils.RFC_6265_SUPPORT_ENABLED);
            } else {
                if (logger.isLoggable(Level.FINE)) {
                    log("Parsing string: " + cookieValue.toString());
                }

                final String value = cookieValue.toString();
                CookieParserUtils.parseServerCookies(this, value,
                        CookieUtils.COOKIE_VERSION_ONE_STRICT_COMPLIANCE,
                        CookieUtils.RFC_6265_SUPPORT_ENABLED);
            }
View Full Code Here

Examples of org.glassfish.grizzly.http.util.DataChunk

        inputBuffer.initialize(this, ctx);
       
        parameters.setHeaders(request.getHeaders());
        parameters.setQuery(request.getQueryStringDC());

        final DataChunk remoteUser = request.remoteUser();
        if (!remoteUser.isNull()) {
            setUserPrincipal(new GrizzlyPrincipal(remoteUser.toString()));
        }

        if (httpServerFilter != null) {
            final ServerFilterConfiguration configuration =
                    httpServerFilter.getConfiguration();
View Full Code Here

Examples of org.glassfish.grizzly.http.util.DataChunk

     */
    protected void parseSessionId() {
        if (sessionParsed) return;

        sessionParsed = true;
        final DataChunk uriDC = request.getRequestURIRef().getRequestURIBC();
       
        final boolean isUpdated;
       
        switch (uriDC.getType()) {
            case Bytes:
                isUpdated = parseSessionId(uriDC.getByteChunk());
                break;
            case Buffer:
                isUpdated = parseSessionId(uriDC.getBufferChunk());
                break;
            case Chars:
                isUpdated = parseSessionId(uriDC.getCharChunk());
                break;
            default:
                throw new IllegalStateException("Unexpected DataChunk type: " + uriDC.getType());
        }
       
        if (isUpdated) {
            uriDC.notifyDirectUpdate();
        }
    }
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.