|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.locomotive.loco.Response
This object encapsulates a response from the Locomotive back to the browser. Typically one would call addString() to add something to the response, then call flush() to send it off to the browser. Alternatively, one can cast this to a ServletResponse and use getOutputStream to write to the response.
Inner Class Summary | |
protected class |
Response.ResponseOutputStream
our little ServletOutputStream. |
Field Summary | |
protected java.lang.String |
char_encoding
|
protected java.lang.String |
content_type
|
protected boolean |
header_was_flushed
|
protected java.io.OutputStream |
os
|
protected int |
reply_type
|
static int |
REPLY_TYPE_CGI
|
static int |
REPLY_TYPE_ISAPI
|
static int |
REPLY_TYPE_NSAPI
|
protected int |
request_id
|
protected Response.ResponseOutputStream |
resos
|
Constructor Summary | |
Response(java.io.OutputStream theos,
int rid,
int reply_type_in)
constructs a new response. |
Method Summary | |
void |
addBytes(byte[] addme)
adds the input byte array to the Response. |
void |
addCookie(javax.servlet.http.Cookie cookie)
Adds a cookie to the headers for this response |
void |
addHTTPHeader(java.lang.String name,
java.lang.String value)
adds an HTTP protocol header to the response. |
void |
addString(java.lang.String s)
appends to the output of the Response. |
void |
clearBody()
clears whatever data is currently resident in the Response body. |
void |
clearHeaders()
wipes all headers for this response. |
boolean |
containsHeader(java.lang.String name)
Returns true if a header with the specified name has been set. |
void |
flush()
Flushes the contents of the Response with no logging. |
void |
flush(Log server_log)
flushes the contents of the response to the OutputStream. |
java.lang.String |
getCharacterEncoding()
returns the character encoding, if it was included in the content type. |
int |
getCurrentResponseLength()
gets the current length of the data in the response buffer. |
int |
getHeaderCount()
returns the number of items currently scheduled to be sent in the HTTP header |
void |
setAutoflush(boolean bol)
setting this to true will cause the Response to flush automatically during every addString() or addBytes () |
void |
setContentType(java.lang.String t)
sets the content type HTTP header to the the input string. |
protected void |
writeHeader(Log server_log)
This writes the headers to the OutputStream in correct protocol. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public static int REPLY_TYPE_CGI
public static int REPLY_TYPE_NSAPI
public static int REPLY_TYPE_ISAPI
protected java.lang.String content_type
protected java.lang.String char_encoding
protected boolean header_was_flushed
protected Response.ResponseOutputStream resos
protected java.io.OutputStream os
protected int request_id
protected int reply_type
Constructor Detail |
public Response(java.io.OutputStream theos, int rid, int reply_type_in)
Method Detail |
public void addHTTPHeader(java.lang.String name, java.lang.String value)
name
- - the namevalue
- - the value associated with name.public int getHeaderCount()
public boolean containsHeader(java.lang.String name)
public void setContentType(java.lang.String t)
t
- the MIME type of the response datapublic java.lang.String getCharacterEncoding()
public void clearHeaders()
public void setAutoflush(boolean bol)
bol
- - true if Response should autoflushpublic void clearBody()
public void flush()
public void flush(Log server_log)
public int getCurrentResponseLength()
public void addString(java.lang.String s)
s
- - the data to be written to the clientpublic void addBytes(byte[] addme)
public void addCookie(javax.servlet.http.Cookie cookie)
protected void writeHeader(Log server_log) throws java.io.IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |