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 java.lang.Object
implements TrackerWebPageResponse


Constructor Summary
protected TrackerWebPageResponseImpl(TrackerWebPageRequestImpl _request)
           
 
Method Summary
protected  java.lang.String addHeader(java.lang.String name, java.lang.String value, boolean replace)
           
protected  void complete()
           
 boolean getAsynchronous()
           
 java.io.OutputStream getOutputStream()
           
 java.io.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(java.lang.String type)
           
 void setExpires(long time)
           
 void setGZIP(boolean gzip)
           
 void setHeader(java.lang.String name, java.lang.String value)
           
 void setLastModified(long time)
           
 void setReplyStatus(int status)
           
 boolean useFile(java.lang.String root_dir, java.lang.String relative_url)
          use a file contents as the response.
 void useStream(java.lang.String file_type, java.io.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(java.lang.String type)
Specified by:
setContentType in interface TrackerWebPageResponse

setReplyStatus

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

setHeader

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

setGZIP

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

addHeader

protected java.lang.String addHeader(java.lang.String name,
                                     java.lang.String value,
                                     boolean replace)

getOutputStream

public java.io.OutputStream getOutputStream()
Specified by:
getOutputStream in interface TrackerWebPageResponse

getRawOutputStream

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

Specified by:
getRawOutputStream in interface TrackerWebPageResponse
Returns:
Throws:
java.io.IOException

isActive

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

complete

protected void complete()
                 throws java.io.IOException
Throws:
java.io.IOException

useFile

public boolean useFile(java.lang.String root_dir,
                       java.lang.String relative_url)
                throws java.io.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:
java.io.IOException

useStream

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

writeTorrent

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

setAsynchronous

public void setAsynchronous(boolean a)
                     throws java.io.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:
java.io.IOException

getAsynchronous

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