org.apache.felix.mosgi.jmx.httpconnector.mx4j.tools.adaptor.http
Class HttpOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by java.io.FilterOutputStream
          extended by java.io.BufferedOutputStream
              extended by org.apache.felix.mosgi.jmx.httpconnector.mx4j.tools.adaptor.http.HttpOutputStream

public class HttpOutputStream
extends BufferedOutputStream

HttpAdaptor sets the basic adaptor listening for HTTP requests

Version:
$Revision: 1.1.1.1 $
Author:
Carlos Quiroz

Field Summary
protected  int code
          Answer code
protected  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(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(String attr, String value)
          Sets a given header code
 void write(InputStream in)
          Writes the content of the input stream to the output stream
 void write(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 Map headers
Headers to be sent

Constructor Detail

HttpOutputStream

public HttpOutputStream(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(String attr,
                      String value)
Sets a given header code

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

sendHeaders

public boolean sendHeaders()
                    throws IOException
Sends the headers

Returns:
Description of the Returned Value
Throws:
IOException - Description of Exception

write

public void write(String msg)
           throws IOException
Writes a given message line

Parameters:
msg - The message to be written
Throws:
IOException

write

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

Parameters:
in - The input stream
Throws:
IOException


Copyright © 2011 Apache Software Foundation. All Rights Reserved.