michael@0: /* michael@0: * ==================================================================== michael@0: * Licensed to the Apache Software Foundation (ASF) under one michael@0: * or more contributor license agreements. See the NOTICE file michael@0: * distributed with this work for additional information michael@0: * regarding copyright ownership. The ASF licenses this file michael@0: * to you under the Apache License, Version 2.0 (the michael@0: * "License"); you may not use this file except in compliance michael@0: * with the License. You may obtain a copy of the License at michael@0: * michael@0: * http://www.apache.org/licenses/LICENSE-2.0 michael@0: * michael@0: * Unless required by applicable law or agreed to in writing, michael@0: * software distributed under the License is distributed on an michael@0: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY michael@0: * KIND, either express or implied. See the License for the michael@0: * specific language governing permissions and limitations michael@0: * under the License. michael@0: * ==================================================================== michael@0: * michael@0: * This software consists of voluntary contributions made by many michael@0: * individuals on behalf of the Apache Software Foundation. For more michael@0: * information on the Apache Software Foundation, please see michael@0: * . michael@0: * michael@0: */ michael@0: package ch.boye.httpclientandroidlib.cookie; michael@0: michael@0: /** michael@0: * This interface represents a cookie attribute handler responsible michael@0: * for parsing, validating, and matching a specific cookie attribute, michael@0: * such as path, domain, port, etc. michael@0: * michael@0: * Different cookie specifications can provide a specific michael@0: * implementation for this class based on their cookie handling michael@0: * rules. michael@0: * michael@0: * michael@0: * @since 4.0 michael@0: */ michael@0: public interface CookieAttributeHandler { michael@0: michael@0: /** michael@0: * Parse the given cookie attribute value and update the corresponding michael@0: * {@link ch.boye.httpclientandroidlib.cookie.Cookie} property. michael@0: * michael@0: * @param cookie {@link ch.boye.httpclientandroidlib.cookie.Cookie} to be updated michael@0: * @param value cookie attribute value from the cookie response header michael@0: */ michael@0: void parse(SetCookie cookie, String value) michael@0: throws MalformedCookieException; michael@0: michael@0: /** michael@0: * Peforms cookie validation for the given attribute value. michael@0: * michael@0: * @param cookie {@link ch.boye.httpclientandroidlib.cookie.Cookie} to validate michael@0: * @param origin the cookie source to validate against michael@0: * @throws MalformedCookieException if cookie validation fails for this attribute michael@0: */ michael@0: void validate(Cookie cookie, CookieOrigin origin) michael@0: throws MalformedCookieException; michael@0: michael@0: /** michael@0: * Matches the given value (property of the destination host where request is being michael@0: * submitted) with the corresponding cookie attribute. michael@0: * michael@0: * @param cookie {@link ch.boye.httpclientandroidlib.cookie.Cookie} to match michael@0: * @param origin the cookie source to match against michael@0: * @return true if the match is successful; false otherwise michael@0: */ michael@0: boolean match(Cookie cookie, CookieOrigin origin); michael@0: michael@0: }