All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.sun.xml.ws.transport.http.client.CookieStore Maven / Gradle / Ivy

/*
 * Copyright (c) 2006, 2018 Oracle and/or its affiliates. All rights reserved.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Distribution License v. 1.0, which is available at
 * http://www.eclipse.org/org/documents/edl-v10.php.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

package com.sun.xml.ws.transport.http.client;

import java.net.URI;
import java.util.List;
import java.util.Map;

/**
 * A CookieStore object represents a storage for cookie. Can store and retrieve
 * cookies.
 *
 * 

{@link CookieManager} will call CookieStore.add to save cookies * for every incoming HTTP response, and call CookieStore.get to * retrieve cookie for every outgoing HTTP request. A CookieStore * is responsible for removing HttpCookie instances which have expired. * * @version %I%, %E% * @author Edward Wang * @since 1.6 */ interface CookieStore { /** * Adds one HTTP cookie to the store. This is called for every * incoming HTTP response. * *

A cookie to store may or may not be associated with an URI. If it * is not associated with an URI, the cookie's domain and path attribute * will indicate where it comes from. If it is associated with an URI and * its domain and path attribute are not speicifed, given URI will indicate * where this cookie comes from. * *

If a cookie corresponding to the given URI already exists, * then it is replaced with the new one. * * @param uri the uri this cookie associated with. * if null, this cookie will not be associated * with an URI * @param cookie the cookie to store * * @throws NullPointerException if cookie is null * * @see #get * */ public void add(URI uri, HttpCookie cookie); /** * Retrieve cookies associated with given URI, or whose domain matches the * given URI. Only cookies that have not expired are returned. * This is called for every outgoing HTTP request. * * @return an immutable list of HttpCookie, * return empty list if no cookies match the given URI * * @throws NullPointerException if uri is null * * @see #add * */ public List get(URI uri); /** * Get all not-expired cookies in cookie store. * * @return an immutable list of http cookies; * return empty list if there's no http cookie in store */ public List getCookies(); /** * Get all URIs which identify the cookies in this cookie store. * * @return an immutable list of URIs; * return empty list if no cookie in this cookie store * is associated with an URI */ public List getURIs(); /** * Remove a cookie from store. * * @param uri the uri this cookie associated with. * if null, the cookie to be removed is not associated * with an URI when added; if not null, the cookie * to be removed is associated with the given URI when added. * @param cookie the cookie to remove * * @return true if this store contained the specified cookie * * @throws NullPointerException if cookie is null */ public boolean remove(URI uri, HttpCookie cookie); /** * Remove all cookies in this cookie store. * * @return true if this store changed as a result of the call */ public boolean removeAll(); }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy