Modifier and Type | Field and Description |
---|---|
protected AbstractBody |
body |
protected Header |
header |
protected String |
version |
Constructor and Description |
---|
Message() |
Modifier and Type | Method and Description |
---|---|
protected void |
createBody(InputStream in) |
AbstractBody |
getBody() |
InputStream |
getBodyAsStream() |
String |
getCharset() |
String |
getErrorMessage() |
Header |
getHeader() |
String |
getName() |
abstract String |
getStartLine() |
String |
getVersion() |
boolean |
hasMsgReleased() |
boolean |
isBodyEmpty() |
boolean |
isCSS() |
boolean |
isDeflate() |
boolean |
isGzip() |
boolean |
isHTML() |
boolean |
isHTTP10() |
boolean |
isHTTP11() |
boolean |
isImage() |
boolean |
isJavaScript() |
boolean |
isJSON() |
boolean |
isKeepAlive() |
boolean |
isXML() |
protected abstract void |
parseStartLine(InputStream in) |
void |
read(InputStream in,
boolean createBody)
If the message is HTTP 1.1 but the header has no information about the
content length, then an assumption is made that after the body the server
will send an EOF.
|
void |
readBody() |
void |
release()
preserve synchronized keyword, notify method is called
|
void |
setBody(AbstractBody b) |
void |
setBodyContent(byte[] content) |
void |
setErrorMessage(String errorMessage) |
void |
setHeader(Header srcHeader) |
void |
setVersion(String version) |
String |
toString() |
void |
write(OutputStream out) |
void |
writeStartLine(OutputStream out)
The start line supposedly only contains ASCII characters.
|
protected Header header
protected AbstractBody body
protected String version
public void read(InputStream in, boolean createBody) throws IOException, EndOfStreamException
IOException
EndOfStreamException
public void readBody() throws IOException
IOException
public AbstractBody getBody()
public InputStream getBodyAsStream()
public void setBody(AbstractBody b)
public void setBodyContent(byte[] content)
protected void createBody(InputStream in) throws IOException
IOException
protected abstract void parseStartLine(InputStream in) throws IOException, EndOfStreamException
IOException
EndOfStreamException
public Header getHeader()
public void release()
public boolean hasMsgReleased()
public void setHeader(Header srcHeader)
public final void write(OutputStream out) throws IOException
IOException
public void writeStartLine(OutputStream out) throws IOException
HttpUtil.readLine(InputStream)
converts the input byte-by-byte
to char-by-char, we use ISO-8859-1 for output.IOException
public abstract String getStartLine()
public boolean isHTTP11()
public boolean isHTTP10()
public String getVersion()
public void setVersion(String version)
public boolean isKeepAlive()
public String getErrorMessage()
public void setErrorMessage(String errorMessage)
public String getName()
public boolean isBodyEmpty() throws IOException
IOException
public boolean isImage()
public boolean isXML()
public boolean isJSON()
public boolean isHTML()
public boolean isCSS()
public boolean isJavaScript()
public boolean isGzip()
public boolean isDeflate()
public String getCharset()
Copyright © 2012. All Rights Reserved.