CacheRequest in Java

java.net.CacheRequest

Represents channels for storing resources in theResponseCache. Instances of such a class provide anOutputStream object which is called by protocol handlers to store the resource data into the cache, and also an abort() method which allows a cache store operation to be interrupted and abandoned.

If an IOException is encountered while reading the response or writing to the cache, the current cache store operation will be aborted.

Declaration

public abstract class CacheRequest {

    public abstract OutputStream getBody() throws IOException;

    public abstract void abort();
}

Methods

1. getBody()

OutputStream java.net.CacheRequest.getBody() throws IOException

Returns an OutputStream to which the response body can be written.

Returns: an OutputStream to which the response body can be written.

Throws:

IOException - if an I/O error occurs while writing the response body.


2. abort()

void java.net.CacheRequest.abort()

Aborts the attempt to cache the response. If an IOException is encountered while reading the response or writing to the cache, the current cache store operation will be abandoned.


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