Package org.cybergarage.http
Class HTTPPacket
- java.lang.Object
-
- org.cybergarage.http.HTTPPacket
-
- Direct Known Subclasses:
HTTPRequest
,HTTPResponse
public class HTTPPacket extends Object
-
-
Constructor Summary
Constructors Constructor Description HTTPPacket()
HTTPPacket(InputStream in)
HTTPPacket(HTTPPacket httpPacket)
-
Method Summary
-
-
-
Constructor Detail
-
HTTPPacket
public HTTPPacket()
-
HTTPPacket
public HTTPPacket(HTTPPacket httpPacket)
-
HTTPPacket
public HTTPPacket(InputStream in)
-
-
Method Detail
-
init
public void init()
-
setVersion
public void setVersion(String ver)
-
getVersion
public String getVersion()
-
set
protected boolean set(InputStream in, boolean onlyHeaders)
-
set
protected boolean set(InputStream in)
-
set
protected boolean set(HTTPSocket httpSock)
-
set
protected void set(HTTPPacket httpPacket)
-
read
public boolean read(HTTPSocket httpSock)
-
getFirstLine
protected String getFirstLine()
-
getFirstLineToken
protected String getFirstLineToken(int num)
-
hasFirstLine
public boolean hasFirstLine()
-
getNHeaders
public int getNHeaders()
-
addHeader
public void addHeader(HTTPHeader header)
-
getHeader
public HTTPHeader getHeader(int n)
-
getHeader
public HTTPHeader getHeader(String name)
-
clearHeaders
public void clearHeaders()
-
hasHeader
public boolean hasHeader(String name)
-
setHeader
public void setHeader(String name, int value)
-
setHeader
public void setHeader(String name, long value)
-
setHeader
public void setHeader(HTTPHeader header)
-
setStringHeader
public void setStringHeader(String name, String value, String startWidth, String endWidth)
-
getStringHeaderValue
public String getStringHeaderValue(String name, String startWidth, String endWidth)
-
setIntegerHeader
public void setIntegerHeader(String name, int value)
-
setLongHeader
public void setLongHeader(String name, long value)
-
getIntegerHeaderValue
public int getIntegerHeaderValue(String name)
-
getLongHeaderValue
public long getLongHeaderValue(String name)
-
getHeaderString
public String getHeaderString()
-
setContent
public void setContent(byte[] data, boolean updateWithContentLength)
-
setContent
public void setContent(byte[] data)
-
setContent
public void setContent(String data, boolean updateWithContentLength)
-
setContent
public void setContent(String data)
-
getContent
public byte[] getContent()
-
getContentString
public String getContentString()
-
hasContent
public boolean hasContent()
-
setContentInputStream
public void setContentInputStream(InputStream in)
-
getContentInputStream
public InputStream getContentInputStream()
-
hasContentInputStream
public boolean hasContentInputStream()
-
setContentType
public void setContentType(String type)
-
getContentType
public String getContentType()
-
setContentLanguage
public void setContentLanguage(String code)
-
getContentLanguage
public String getContentLanguage()
-
getCharSet
public String getCharSet()
-
setContentLength
public void setContentLength(long len)
-
getContentLength
public long getContentLength()
-
hasConnection
public boolean hasConnection()
-
setConnection
public void setConnection(String value)
-
getConnection
public String getConnection()
-
isCloseConnection
public boolean isCloseConnection()
-
isKeepAliveConnection
public boolean isKeepAliveConnection()
-
hasContentRange
public boolean hasContentRange()
-
setContentRange
public void setContentRange(long firstPos, long lastPos, long length)
-
getContentRange
public long[] getContentRange()
-
getContentRangeFirstPosition
public long getContentRangeFirstPosition()
-
getContentRangeLastPosition
public long getContentRangeLastPosition()
-
getContentRangeInstanceLength
public long getContentRangeInstanceLength()
-
setCacheControl
public void setCacheControl(String directive)
-
setCacheControl
public void setCacheControl(String directive, int value)
-
setCacheControl
public void setCacheControl(int value)
-
getCacheControl
public String getCacheControl()
-
setServer
public void setServer(String name)
-
getServer
public String getServer()
-
setHost
public void setHost(String host, int port)
-
setHost
public void setHost(String host)
-
getHost
public String getHost()
-
setDate
public void setDate(Calendar cal)
-
getDate
public String getDate()
-
hasTransferEncoding
public boolean hasTransferEncoding()
-
setTransferEncoding
public void setTransferEncoding(String value)
-
getTransferEncoding
public String getTransferEncoding()
-
isChunked
public boolean isChunked()
-
-