CookieManager class in Java

java.net.CookieManager

CookieManager provides a concrete implementation of CookieHandler, which separates the storage of cookies from the policy surrounding accepting and rejecting cookies. A CookieManager is initialized with a CookieStore which manages storage, and a CookiePolicy object, which makes policy decisions on cookie acceptance/rejection.

Some methods of CookieManager class

CookieManager()Create a new cookie manager.

CookieManager(CookieStore, CookiePolicy)This method creates a new cookie manager with a specified cookie store and cookie policy.

get(URI, Map)This method gets all the applicable cookies from a cookie cache for the specified uri in the request header.

getCookieStore()To retrieve the current cookie store.

put(URI, Map)This method sets all the applicable cookies, examples are response header fields that are named Set-Cookie2, present in the response headers into a cookie cache.

setCookiePolicy(CookiePolicy)To set the cookie policy of this cookie manager.


Some other classes/interfaces of java.net

AuthenticatorThe class Authenticator represents an object that knows how to obtain authentication for a network connection.

BindExceptionSignals that an error occurred while attempting to bind a socket to a local address and port. 

CacheRequestRepresents channels for storing resources in the ResponseCache.

CacheResponseRepresent channels for retrieving resources from the ResponseCache.

ConnectExceptionSignals that an error occurred while attempting to connect a socket to a remote address and port.

ContentHandlerThe abstract class ContentHandler is the superclass of all classes that read an Object from a URLConnection.

ContentHandlerFactoryThis interface defines a factory for content handlers. Implementing this interface should map a MIME type into an instance of ContentHandler.

CookieHandlerA CookieHandler object provides a callback mechanism to hook up an HTTP state management policy implementation into the HTTP protocol handler.

CookieManagerCookieManager provides a concrete implementation of CookieHandler, which separates the storage of cookies from the policy surrounding accepting and rejecting cookies. 

CookiePolicyCookiePolicy implementations decide which cookies should be accepted and which should be rejected.

CookieStoreA CookieStore object represents storage for cookies. Can store and retrieve cookies.

DatagramPacketThis class represents a datagram packet.

No comments:

Post a Comment