|
Java Platform 1.2 Beta 4 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.net.URLConnection.Callback
For backward compatibility reasons, the callback object is not guaranteed to be called by all connection objects. Implementation of protocol handlers are required to support callback objects.
URLConnection.setCallback(java.net.URLConnection.Callback)
,
URLConnection.getCallback()
Method Summary | |
abstract void | afterConnection(URLConnection connection)
This method should be invoked by a connection object after a connection has been established. |
abstract boolean | afterEvent(URLConnection connection,
IOException exception)
This method should be invoked by a connection object after a connection has been attempted and an exceptional condition has been encountered. |
abstract void | beforeConnection(URLConnection connection)
This method should be invoked by a connection object before a connection is established. |
Methods inherited from class java.lang.Object | |
clone , equals , finalize , getClass , hashCode , notify , notifyAll , toString , wait , wait , wait |
Method Detail |
public abstract void beforeConnection(URLConnection connection) throws IOException
If the callback object wishes to abort the connection, it should throw an IOException, and the connection object should let the exception be thrown.
connection
- the connection on which the callback is
being performed.public abstract void afterConnection(URLConnection connection) throws IOException
If the callback object decides that the resulting connection is invalid, it should the connection by throwing an exception. Protocol handlers, in turn, should call into the callback object before they set the connected flag of the connection so that if the callback throws an exception, the connection is not left in a connected state.
connection
- the connection on which the callback is
being performed.public abstract boolean afterEvent(URLConnection connection, IOException exception) throws IOException
If the callback wants to let the failure stand, and let the connection itself throw the exception, it should return false. If it wants to retry the connection, it should return true. The default implementation throws the exception argument if it is not null and returns false if the exception argument is null.
connection
- the connection on which the callback is
being performed.
exception
- the exception raised, if any. The
exception will be a valid IOException for I/O errors, such
as UnknownHostException, and will be null in case of a
protocol error, such as a HTTP document not found (404)
error or an FTP authentication failure.
|
Java Platform 1.2 Beta 4 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |