org.gudy.azureus2.pluginsimpl.local.tracker
Class TrackerWebPageResponseImpl

java.lang.Object
  extended by org.gudy.azureus2.pluginsimpl.local.tracker.TrackerWebPageResponseImpl
All Implemented Interfaces:
TrackerWebPageResponse

public class TrackerWebPageResponseImpl
extends Object
implements TrackerWebPageResponse


Constructor Summary
protected TrackerWebPageResponseImpl(TrackerWebPageRequestImpl _request)
           
 
Method Summary
protected  String addHeader(String name, String value, boolean replace)
           
protected  void complete()
           
 boolean getAsynchronous()
           
 OutputStream getOutputStream()
           
 OutputStream getRawOutputStream()
          Request complete responsibility for writing the output stream
 boolean isActive()
           
 void setAsynchronous(boolean a)
          For a non-blocking tracker the construction of the response can be completed asynchronously by setting async=true and then, when complete, setting it to false
 void setContentType(String type)
           
 void setExpires(long time)
           
 void setGZIP(boolean gzip)
           
 void setHeader(String name, String value)
           
 void setLastModified(long time)
           
 void setReplyStatus(int status)
           
 boolean useFile(String root_dir, String relative_url)
          use a file contents as the response.
 void useStream(String file_type, InputStream input_stream)
           
 void writeTorrent(TrackerTorrent tracker_torrent)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TrackerWebPageResponseImpl

protected TrackerWebPageResponseImpl(TrackerWebPageRequestImpl _request)
Method Detail

setLastModified

public void setLastModified(long time)
Specified by:
setLastModified in interface TrackerWebPageResponse

setExpires

public void setExpires(long time)
Specified by:
setExpires in interface TrackerWebPageResponse

setContentType

public void setContentType(String type)
Specified by:
setContentType in interface TrackerWebPageResponse

setReplyStatus

public void setReplyStatus(int status)
Specified by:
setReplyStatus in interface TrackerWebPageResponse

setHeader

public void setHeader(String name,
                      String value)
Specified by:
setHeader in interface TrackerWebPageResponse

setGZIP

public void setGZIP(boolean gzip)
Specified by:
setGZIP in interface TrackerWebPageResponse

addHeader

protected String addHeader(String name,
                           String value,
                           boolean replace)

getOutputStream

public OutputStream getOutputStream()
Specified by:
getOutputStream in interface TrackerWebPageResponse

getRawOutputStream

public OutputStream getRawOutputStream()
                                throws IOException
Description copied from interface: TrackerWebPageResponse
Request complete responsibility for writing the output stream

Specified by:
getRawOutputStream in interface TrackerWebPageResponse
Returns:
Throws:
IOException

isActive

public boolean isActive()
Specified by:
isActive in interface TrackerWebPageResponse

complete

protected void complete()
                 throws IOException
Throws:
IOException

useFile

public boolean useFile(String root_dir,
                       String relative_url)
                throws IOException
Description copied from interface: TrackerWebPageResponse
use a file contents as the response. returns true of loaded ok, false if doesn't exist exception if error occurred during processing.

Specified by:
useFile in interface TrackerWebPageResponse
Parameters:
root_dir - e.g. c:\temp\parp or /tmp/trout/
relative_url - e.g. /here/there/wibble.html
Returns:
Throws:
IOException

useStream

public void useStream(String file_type,
                      InputStream input_stream)
               throws IOException
Specified by:
useStream in interface TrackerWebPageResponse
Throws:
IOException

writeTorrent

public void writeTorrent(TrackerTorrent tracker_torrent)
                  throws IOException
Specified by:
writeTorrent in interface TrackerWebPageResponse
Throws:
IOException

setAsynchronous

public void setAsynchronous(boolean a)
                     throws IOException
Description copied from interface: TrackerWebPageResponse
For a non-blocking tracker the construction of the response can be completed asynchronously by setting async=true and then, when complete, setting it to false

Specified by:
setAsynchronous in interface TrackerWebPageResponse
Throws:
IOException

getAsynchronous

public boolean getAsynchronous()
Specified by:
getAsynchronous in interface TrackerWebPageResponse