com.oaklandsw.http
Class AbstractCallback

java.lang.Object
  extended bycom.oaklandsw.http.AbstractCallback
All Implemented Interfaces:
Callback

public class AbstractCallback
extends java.lang.Object
implements Callback

Default implementation of the Callback interface that does nothing.


Constructor Summary
AbstractCallback()
           
 
Method Summary
 void error(HttpURLConnection urlCon, java.io.InputStream is, java.lang.Exception ex)
          Some error happened that caused the connection to fail.
 void readResponse(HttpURLConnection urlCon, java.io.InputStream is)
          This connection is ready to have its data read, and has completed successfully.
 void writeRequest(HttpURLConnection urlCon, java.io.OutputStream os)
          This connection is ready to have its data written.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractCallback

public AbstractCallback()
Method Detail

readResponse

public void readResponse(HttpURLConnection urlCon,
                         java.io.InputStream is)
Description copied from interface: Callback
This connection is ready to have its data read, and has completed successfully. This is used either for a pipelined or a non-blocking connection, and is called after the response has been received. This will be called only once per connection, and in the same order as writeRequest is called.

Specified by:
readResponse in interface Callback
Parameters:
urlCon - the connection.
is - the InputStream on which to read the data. Call the close() method on this when done. This will be provided even in the exception case if there is anything to read.

writeRequest

public void writeRequest(HttpURLConnection urlCon,
                         java.io.OutputStream os)
Description copied from interface: Callback
This connection is ready to have its data written. This is used only for a non-blocking connection when using streaming and is called after the underlying socket connection has been established and the request headers have been sent.

Specified by:
writeRequest in interface Callback
Parameters:
urlCon - the connection.
os - the OutputStream on which the data is written. Call the close() method on this when done.

error

public void error(HttpURLConnection urlCon,
                  java.io.InputStream is,
                  java.lang.Exception ex)
Description copied from interface: Callback
Some error happened that caused the connection to fail. This could either be an IOException or one of its subclasses or an bad (>= 400) response code from the server.

Specified by:
error in interface Callback
Parameters:
urlCon - the connection.
is - the InputStream on which to read the data, if there is any data to report.
ex - an Exception. The Exception can be null if this is being called because of an bad response code.


Copyright © 2002-2007 Oakland Software Incorporated. All Rights Reserved.