Package org.apache.commons.httpclient.cookie

Examples of org.apache.commons.httpclient.cookie.MalformedCookieException


            else
            {
                String message = String.format(
                    "The uri (%1s) does not specify a port and no default is available for its scheme (%2s).",
                    uri, scheme);
                throw new MalformedCookieException(message);
            }
        }
        return port;
    }
View Full Code Here


            else
            {
                String message = String.format(
                    "The uri (%1s) does not specify a port and no default is available for its scheme (%2s).",
                    uri, scheme);
                throw new MalformedCookieException(message);
            }
        }
        return port;
    }
View Full Code Here

            path = PATH_DELIM;
        }
        host = host.toLowerCase();
        // check version
        if (cookie.getVersion() < 0) {
            throw new MalformedCookieException ("Illegal version number "
                + cookie.getValue());
        }

        // security check... we musn't allow the server to give us an
        // invalid domain scope

        // Validate the cookies domain attribute.  NOTE:  Domains without
        // any dots are allowed to support hosts on private LANs that don't
        // have DNS names.  Since they have no dots, to domain-match the
        // request-host and domain must be identical for the cookie to sent
        // back to the origin-server.
        if (host.indexOf(".") >= 0) {
            // Not required to have at least two dots.  RFC 2965.
            // A Set-Cookie2 with Domain=ajax.com will be accepted.

            // domain must match host
            if (!host.endsWith(cookie.getDomain())) {
                String s = cookie.getDomain();
                if (s.startsWith(".")) {
                    s = s.substring(1, s.length());
                }
                if (!host.equals(s)) {
                    throw new MalformedCookieException(
                        "Illegal domain attribute \"" + cookie.getDomain()
                        + "\". Domain of origin: \"" + host + "\"");
                }
            }
        } else {
            if (!host.equals(cookie.getDomain())) {
                throw new MalformedCookieException(
                    "Illegal domain attribute \"" + cookie.getDomain()
                    + "\". Domain of origin: \"" + host + "\"");
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.httpclient.cookie.MalformedCookieException

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.