Package org.glassfish.grizzly.http.util

Examples of org.glassfish.grizzly.http.util.MimeHeaders$MaxHeaderCountExceededException


        String name = cookie.getName();
        final String headername = "Set-Cookie";
        final String startsWith = name + "=";
        final String cookieString = getCookieString(cookie);
        boolean set = false;
        MimeHeaders headers = coyoteResponse.getResponse().getHeaders();
        int n = headers.size();
        for (int i = 0; i < n; i++) {
            if (headers.getName(i).toString().equals(headername)) {
                if (headers.getValue(i).toString().startsWith(startsWith)) {
                    headers.getValue(i).setString(cookieString);
                    set = true;
                }
            }
        }
        if (!set) {
View Full Code Here


        String name = cookie.getName();
        final String headername = "Set-Cookie";
        final String startsWith = name + "=";
        final String cookieString = getCookieString(cookie);
        boolean set = false;
        MimeHeaders headers = coyoteResponse.getResponse().getHeaders();
        int n = headers.size();
        for (int i = 0; i < n; i++) {
            if (headers.getName(i).toString().equals(headername)) {
                if (headers.getValue(i).toString().startsWith(startsWith)) {
                    headers.getValue(i).setString(cookieString);
                    set = true;
                }
            }
        }
        if (!set) {
View Full Code Here

        String name = cookie.getName();
        final String headername = "Set-Cookie";
        final String startsWith = name + "=";
        final String cookieString = getCookieString(cookie);
        boolean set = false;
        MimeHeaders headers = coyoteResponse.getResponse().getHeaders();
        int n = headers.size();
        for (int i = 0; i < n; i++) {
            if (headers.getName(i).toString().equals(headername)) {
                if (headers.getValue(i).toString().startsWith(startsWith)) {
                    headers.getValue(i).setString(cookieString);
                    set = true;
                }
            }
        }
        if (!set) {
View Full Code Here

        String name = cookie.getName();
        final String headername = "Set-Cookie";
        final String startsWith = name + "=";
        final String cookieString = getCookieString(cookie);
        boolean set = false;
        MimeHeaders headers = coyoteResponse.getResponse().getHeaders();
        int n = headers.size();
        for (int i = 0; i < n; i++) {
            if (headers.getName(i).toString().equals(headername)) {
                if (headers.getValue(i).toString().startsWith(startsWith)) {
                    headers.getValue(i).setString(cookieString);
                    set = true;
                }
            }
        }
        if (!set) {
View Full Code Here

        String name = cookie.getName();
        final String headername = "Set-Cookie";
        final String startsWith = name + "=";
        final String cookieString = getCookieString(cookie);
        boolean set = false;
        MimeHeaders headers = coyoteResponse.getResponse().getHeaders();
        int n = headers.size();
        for (int i = 0; i < n; i++) {
            if (headers.getName(i).toString().equals(headername)) {
                if (headers.getValue(i).toString().startsWith(startsWith)) {
                    headers.getValue(i).setString(cookieString);
                    set = true;
                }
            }
        }
        if (!set) {
View Full Code Here

    private static void checkHttpTrailer(final HttpContent httpContent) {
        if (HttpTrailer.isTrailer(httpContent)) {
            final HttpTrailer httpTrailer = (HttpTrailer) httpContent;
            final HttpHeader httpHeader = httpContent.getHttpHeader();
           
            final MimeHeaders trailerHeaders = httpTrailer.getHeaders();
            final int size = trailerHeaders.size();
            for (int i = 0; i < size; i++) {
                httpHeader.addHeader(
                        trailerHeaders.getName(i).toString(),
                        trailerHeaders.getValue(i).toString());
            }
        }
    }   
View Full Code Here

            key.recycle();
            return CacheResult.FAILED_CACHE_FULL;
        }

        final HttpResponsePacket response = request.getResponse();
        final MimeHeaders headers = response.getHeaders();
       
        final String contentType = response.getContentType();
       
        final FileCacheEntry entry;
        if (cacheFile != null) { // If we have a file - try to create File-aware cache resource
            entry = createEntry(cacheFile);
            entry.setCanBeCompressed(canBeCompressed(cacheFile, contentType));
        } else {
            entry = new FileCacheEntry(this);
            entry.type = CacheType.TIMESTAMP;
        }

        entry.key = key;
        entry.requestURI = requestURI;

        entry.lastModified = lastModified;
        entry.contentType = ContentType.newContentType(contentType);
        entry.xPoweredBy = headers.getHeader(Header.XPoweredBy);
        entry.date = headers.getHeader(Header.Date);
        entry.lastModifiedHeader = headers.getHeader(Header.LastModified);
        entry.host = host;
        entry.Etag = headers.getHeader(Header.ETag);
        entry.server = headers.getHeader(Header.Server);

        fileCacheMap.put(key, entry);
       
        notifyProbesEntryAdded(this, entry);
       
View Full Code Here

     * Return an array of all the header names set for this response, or
     * a zero-length array if no headers have been set.
     */
    public String[] getHeaderNames() {
        checkResponse();
        MimeHeaders headers = response.getHeaders();
        int n = headers.size();
        String[] result = new String[n];
        for (int i = 0; i < n; i++) {
            result[i] = headers.getName(i).toString();
        }
        return result;

    }
View Full Code Here

        }
       
        final String cookieString = sb.toString();
       
        boolean set = false;
        MimeHeaders headers = response.getHeaders();
        int n = headers.size();
        for (int i = 0; i < n; i++) {
            if (headers.getName(i).toString().equals(headername)) {
                if (headers.getValue(i).toString().startsWith(startsWith)) {
                    headers.getValue(i).setString(cookieString);
                    set = true;
                }
            }
        }
        if (!set) {
View Full Code Here

        if (request.getHeaderParsingState().contentLengthsDiffer) {
            request.getProcessingState().error = true;
            return;
        }
       
        final MimeHeaders headers = request.getHeaders();
       
        DataChunk hostDC = null;
       
        // Check for a full URI (including protocol://host:port/)
       
        final DataChunk uriBC = request.getRequestURIRef().getRequestURIBC();
       
        if (uriBC.startsWithIgnoreCase("http", 0)) {

            int pos = uriBC.indexOf("://", 4);
            int uriBCStart = uriBC.getStart();
            int slashPos;
            if (pos != -1) {
//                final Buffer uriB = uriBC.getBuffer();
                slashPos = uriBC.indexOf('/', pos + 3);
                if (slashPos == -1) {
                    slashPos = uriBC.getLength();
                    // Set URI as "/"
                    uriBC.setStart(uriBCStart + pos + 1);
                    uriBC.setEnd(uriBCStart + pos + 2);
                } else {
                    uriBC.setStart(uriBCStart + slashPos);
                    uriBC.setEnd(uriBC.getEnd());
                }
                hostDC = headers.setValue(Header.Host);
                hostDC.set(uriBC, uriBCStart + pos + 3, uriBCStart + slashPos);
            }

        }

        // --------------------------

        if (hostDC == null) {
            hostDC = headers.getValue(Header.Host);
        }

        final boolean isHttp11 = protocol == Protocol.HTTP_1_1;
       
        // Check host header
        if (isHttp11 && (hostDC == null || hostDC.isNull())) {
            state.error = true;
            return;
        }
        request.unparsedHostC = hostDC;
       
        // If it's upgraded HTTP - don't check semantics
        if (isUpgraded) {
            return;
        }

        final Method method = request.getMethod();
       
        final PayloadExpectation payloadExpectation = method.getPayloadExpectation();
        if (payloadExpectation != PayloadExpectation.NOT_ALLOWED) {
            final boolean hasPayload =
                    request.getContentLength() > 0 || request.isChunked();
           
            if (hasPayload && payloadExpectation == PayloadExpectation.UNDEFINED &&
                    !allowPayloadForUndefinedHttpMethods) {
                // if payload is not allowed for the "undefined" methods
                state.error = true;
                // Send 400; Bad Request
                HttpStatus.BAD_REQUEST_400.setValues(response);
                return;
            }
           
            request.setExpectContent(hasPayload);
        } else {
            request.setExpectContent(method == Method.CONNECT);
        }
       
        // ------ Set keep-alive flag
        if (method == Method.CONNECT) {
            state.keepAlive = false;
        } else {
            final DataChunk connectionValueDC = headers.getValue(Header.Connection);
            final boolean isConnectionClose = (connectionValueDC != null &&
                    connectionValueDC.equalsIgnoreCaseLowerCase(CLOSE_BYTES));

            if (!isConnectionClose) {
                state.keepAlive = allowKeepAlive && (isHttp11 ||
View Full Code Here

TOP

Related Classes of org.glassfish.grizzly.http.util.MimeHeaders$MaxHeaderCountExceededException

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.