mx4j.tools.adaptor.http

Class HttpOutputStream

public class HttpOutputStream extends BufferedOutputStream

HttpAdaptor sets the basic adaptor listening for HTTP requests

Version: $Revision: 1.3 $

Field Summary
protected intcode
Answer code
protected Mapheaders
Headers to be sent
protected booleansendHeaders
whether to send the headers
Constructor Summary
HttpOutputStream(OutputStream out, HttpInputStream in)
Creates a new HttpOutputStream with a given OutputStream and an InputStream
Method Summary
booleansendHeaders()
Sends the headers
voidsetCode(int code)
Sets the answer code
voidsetHeader(String attr, String value)
Sets a given header code
voidwrite(String msg)
Writes a given message line
voidwrite(InputStream in)
Writes the content of the input stream to the output stream

Field Detail

code

protected int code
Answer code

headers

protected Map headers
Headers to be sent

sendHeaders

protected boolean sendHeaders
whether to send the headers

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

sendHeaders

public boolean sendHeaders()
Sends the headers

Returns: Description of the Returned Value

Throws: IOException Description of Exception

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

write

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

Parameters: msg The message to be written

Throws: IOException

write

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

Parameters: in The input stream

Throws: IOException

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