mx4j.tools.adaptor.http
Class HttpOutputStream

java.lang.Object
  extended byjava.io.OutputStream
      extended byjava.io.FilterOutputStream
          extended byjava.io.BufferedOutputStream
              extended bymx4j.tools.adaptor.http.HttpOutputStream

public class HttpOutputStream
extends java.io.BufferedOutputStream

HttpAdaptor sets the basic adaptor listening for HTTP requests

Version:
$Revision: 1.3 $

Field Summary
protected  int code
          Answer code
protected  java.util.Map headers
          Headers to be sent
protected  boolean sendHeaders
          whether to send the headers
 
Fields inherited from class java.io.BufferedOutputStream
buf, count
 
Fields inherited from class java.io.FilterOutputStream
out
 
Constructor Summary
HttpOutputStream(java.io.OutputStream out, HttpInputStream in)
          Creates a new HttpOutputStream with a given OutputStream and an InputStream
 
Method Summary
 boolean sendHeaders()
          Sends the headers
 void setCode(int code)
          Sets the answer code
 void setHeader(java.lang.String attr, java.lang.String value)
          Sets a given header code
 void write(java.io.InputStream in)
          Writes the content of the input stream to the output stream
 void write(java.lang.String msg)
          Writes a given message line
 
Methods inherited from class java.io.BufferedOutputStream
flush, write, write
 
Methods inherited from class java.io.FilterOutputStream
close, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

code

protected int code
Answer code


sendHeaders

protected boolean sendHeaders
whether to send the headers


headers

protected java.util.Map headers
Headers to be sent

Constructor Detail

HttpOutputStream

public HttpOutputStream(java.io.OutputStream out,
                        HttpInputStream in)
Creates a new HttpOutputStream with a given OutputStream and an InputStream

Parameters:
out - The OutputStream normally associated with the output socket

stream of the incoming connection

in - HttpInputStream containing the incoming request
Method Detail

setCode

public void setCode(int code)
Sets the answer code

Parameters:
code - The new code value

setHeader

public void setHeader(java.lang.String attr,
                      java.lang.String value)
Sets a given header code

Parameters:
attr - The new header name
value - The new header value

sendHeaders

public boolean sendHeaders()
                    throws java.io.IOException
Sends the headers

Returns:
Description of the Returned Value
Throws:
java.io.IOException - Description of Exception

write

public void write(java.lang.String msg)
           throws java.io.IOException
Writes a given message line

Parameters:
msg - The message to be written
Throws:
java.io.IOException

write

public void write(java.io.InputStream in)
           throws java.io.IOException
Writes the content of the input stream to the output stream

Parameters:
in - The input stream
Throws:
java.io.IOException


Copyright © 2001-2005 The MX4J Contributors. All Rights Reserved.