php.java.bridge.http
Class HttpResponse

java.lang.Object
  extended by php.java.bridge.http.HttpResponse

public class HttpResponse
extends java.lang.Object

A simple HTTP response implementation.

Author:
jostb

Constructor Summary
HttpResponse(java.io.OutputStream outputStream)
          Create a new HTTP response with the given OutputStream
 
Method Summary
 void addHeader(java.lang.String string, java.lang.String string2)
          Add a response header, in this implementation identical to setHeader
 void close()
          Close the response
 void flushBuffer()
           
 java.io.OutputStream getOutputStream()
          Returns the OutputStream of the response.
 void setContentLength(int length)
          Set the content length of the response.
 void setHeader(java.lang.String string, java.lang.String val)
          Set the response header
 void setStatus(int code)
          Set the response status.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpResponse

public HttpResponse(java.io.OutputStream outputStream)
Create a new HTTP response with the given OutputStream

Parameters:
outputStream - The OutputStream. /*
Method Detail

setHeader

public void setHeader(java.lang.String string,
                      java.lang.String val)
Set the response header

Parameters:
string - The header key
val - The header value.

getOutputStream

public java.io.OutputStream getOutputStream()
Returns the OutputStream of the response. setContentLength() must be called before.

Returns:
The OutputStream
See Also:
HttpRequest.setContentLength(int)

setStatus

public void setStatus(int code)
Set the response status. Not implemented.

Parameters:
code -

addHeader

public void addHeader(java.lang.String string,
                      java.lang.String string2)
Add a response header, in this implementation identical to setHeader

Parameters:
string - The header
string2 - The header value
See Also:
setHeader(String, String)

setContentLength

public void setContentLength(int length)
                      throws java.io.IOException
Set the content length of the response. Sets the "Content-Length" header value.

Parameters:
length - The content length
Throws:
java.io.IOException
See Also:
getOutputStream()

close

public void close()
           throws java.io.IOException
Close the response

Throws:
java.io.IOException

flushBuffer

public void flushBuffer()
                 throws java.io.IOException
Throws:
java.io.IOException