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 int
code
Answer code
protected Map
headers
Headers to be sent
protected boolean
sendHeaders
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

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

Field Details

code

protected int code
Answer code

headers

protected Map headers
Headers to be sent

sendHeaders

protected boolean sendHeaders
whether to send the headers

Constructor Details

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 Details

sendHeaders

public boolean sendHeaders()
            throws IOException
Sends the headers
Returns:
Description of the Returned Value

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(InputStream in)
            throws IOException
Writes the content of the input stream to the output stream
Parameters:
in - The input stream

write

public void write(String msg)
            throws IOException
Writes a given message line
Parameters:
msg - The message to be written

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