Package com.wowza.io
Class HTTPByteWriter
- Object
-
- com.wowza.io.HTTPByteWriter
-
public class HTTPByteWriter extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
HTTPByteWriter.SendResult
-
Field Summary
Fields Modifier and Type Field Description protected int
addrIdx
static int
BUFFERINCSIZE
protected Class<? extends HTTPByteWriter>
CLASS
protected String
CLASSNAME
protected int
connectionTimeout
static int
CONNECTIONTIMEOUT
static String
CRLF
protected org.apache.commons.lang.time.FastDateFormat
dateFormat
protected java.util.List<String>
debugInfo
protected String
debugPrefix
static int
HEADINDEX_CONTENTLENGTH
static int
HEADINDEX_LASTMODIFIED
static int
HEADINDEX_SIZE
static int
HEADINDEX_STATUS
protected String
host
protected boolean
isSSL
static int
LOG_ALL
static int
LOG_DEBUG
static int
LOG_DEFAULT
static int
LOG_DNS
static int
LOG_FRAGMENTS
static int
LOG_QUIET
static int
LOG_REQHEADERS
static int
LOG_TIMEOUTS
protected int
logOptions
static int
MAXHEADERSIZE
protected int
maxRetries
static int
MAXRETRIES
protected int
maxUsesBeforeReconnect
protected StringBuffer
msgBuf
protected Boolean
nonblocked
protected String[]
parseDateFormats
protected int
port
protected String
proxyHost
protected int
proxyPort
protected int
readWriteTimeout
static int
READWRITETIMEOUT
protected int
receiveBufferSize
static int
RECEIVEBUFFERSIZE
protected String
reqPath
protected boolean
requestFullURL
protected long
retryTimeout
static long
RETRYWAITTIME
protected int
sendBufferSize
static int
SENDBUFFERSIZE
protected java.net.Socket
socket
protected java.nio.channels.SocketChannel
socketChannel
protected String
userAgent
protected int
uses
-
Constructor Summary
Constructors Constructor Description HTTPByteWriter(String host, int port, Boolean nonblocked)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addLogOptions(int options)
void
close()
void
connect()
HTTPByteReaderResult
delete(String path)
HTTPByteReaderResult
deleteDirect(String path)
protected void
dumpDebug()
int
getConnectionTimeout()
protected String
getContextPath()
protected void
getDeleteCommand(String path)
boolean
getIsSSL()
int
getLogOptions()
int
getMaxRetries()
int
getMaxUsesBeforeReconnect()
protected void
getPostMessage(String method, String path, PacketFragmentList fragmentList)
int
getReadWriteTimeout()
int
getReceiveBufferSize()
protected String
getRequestPath(String path, String host, int port)
long
getRetryTimeout()
int
getSendBufferSize()
String
getUserAgent()
protected boolean
init()
protected void
initHandShake()
protected boolean
innerConnect()
boolean
isLogOption(int option)
boolean
isOpen()
boolean
isRequestFullURL()
protected void
parseHeader(HTTPByteWriter.SendResult result, byte[] buffer, int offset, int len, boolean isHead)
static int
parseLogOptions(String options)
protected void
reconnect()
void
removeLogOptions(int options)
HTTPByteWriter.SendResult
sendRequest(byte[] request, boolean isHead)
HTTPByteWriter.SendResult
sendRequest(byte[] request, PacketFragmentList fragmentList, int len, boolean isHead)
HTTPByteWriter.SendResult
sendRequestBlocked(byte[] request, PacketFragmentList fragmentList, int len, boolean isHead)
HTTPByteWriter.SendResult
sendRequestNonBlocked(byte[] request, PacketFragmentList fragmentList, int len, boolean isHead)
void
setConnectionTimeout(int connectionTimeout)
void
setIsSSL(boolean ssl)
void
setLogOptions(int options)
void
setMaxRetries(int maxRetries)
void
setMaxUsesBeforeReconnect(int maxUsesBeforeReconnect)
void
setProxyAddress(String host, int port)
void
setReadWriteTimeout(int readWriteTimeout)
void
setReceiveBufferSize(int receiveBufferSize)
void
setRequestFullURL(boolean requestFullURL)
void
setRetryTimeout(long timeout)
void
setSendBufferSize(int sendBufferSize)
void
setUserAgent(String userAgent)
protected int
socketRead(java.nio.ByteBuffer readBuffer)
protected int
socketWrite(java.nio.ByteBuffer reqBuffer)
HTTPByteReaderResult
write(String method, String path, byte[] buffer, int offset, int len)
HTTPByteReaderResult
write(String method, String path, PacketFragmentList fragmentList)
HTTPByteReaderResult
write(String method, String path, String str)
HTTPByteReaderResult
writeDirect(String method, String path, PacketFragmentList fragmentList)
-
-
-
Field Detail
-
CLASSNAME
protected String CLASSNAME
-
CLASS
protected Class<? extends HTTPByteWriter> CLASS
-
MAXHEADERSIZE
public static final int MAXHEADERSIZE
- See Also:
- Constant Field Values
-
BUFFERINCSIZE
public static final int BUFFERINCSIZE
- See Also:
- Constant Field Values
-
READWRITETIMEOUT
public static final int READWRITETIMEOUT
- See Also:
- Constant Field Values
-
CONNECTIONTIMEOUT
public static final int CONNECTIONTIMEOUT
- See Also:
- Constant Field Values
-
SENDBUFFERSIZE
public static final int SENDBUFFERSIZE
- See Also:
- Constant Field Values
-
RECEIVEBUFFERSIZE
public static final int RECEIVEBUFFERSIZE
- See Also:
- Constant Field Values
-
MAXRETRIES
public static final int MAXRETRIES
- See Also:
- Constant Field Values
-
RETRYWAITTIME
public static final long RETRYWAITTIME
- See Also:
- Constant Field Values
-
CRLF
public static final String CRLF
- See Also:
- Constant Field Values
-
HEADINDEX_STATUS
public static final int HEADINDEX_STATUS
- See Also:
- Constant Field Values
-
HEADINDEX_CONTENTLENGTH
public static final int HEADINDEX_CONTENTLENGTH
- See Also:
- Constant Field Values
-
HEADINDEX_LASTMODIFIED
public static final int HEADINDEX_LASTMODIFIED
- See Also:
- Constant Field Values
-
HEADINDEX_SIZE
public static final int HEADINDEX_SIZE
- See Also:
- Constant Field Values
-
LOG_QUIET
public static final int LOG_QUIET
- See Also:
- Constant Field Values
-
LOG_TIMEOUTS
public static final int LOG_TIMEOUTS
- See Also:
- Constant Field Values
-
LOG_DEBUG
public static final int LOG_DEBUG
- See Also:
- Constant Field Values
-
LOG_FRAGMENTS
public static final int LOG_FRAGMENTS
- See Also:
- Constant Field Values
-
LOG_DNS
public static final int LOG_DNS
- See Also:
- Constant Field Values
-
LOG_REQHEADERS
public static final int LOG_REQHEADERS
- See Also:
- Constant Field Values
-
LOG_ALL
public static final int LOG_ALL
- See Also:
- Constant Field Values
-
LOG_DEFAULT
public static final int LOG_DEFAULT
- See Also:
- Constant Field Values
-
host
protected String host
-
port
protected int port
-
reqPath
protected String reqPath
-
proxyHost
protected String proxyHost
-
proxyPort
protected int proxyPort
-
dateFormat
protected org.apache.commons.lang.time.FastDateFormat dateFormat
-
socket
protected java.net.Socket socket
-
socketChannel
protected java.nio.channels.SocketChannel socketChannel
-
msgBuf
protected StringBuffer msgBuf
-
maxRetries
protected int maxRetries
-
maxUsesBeforeReconnect
protected int maxUsesBeforeReconnect
-
retryTimeout
protected long retryTimeout
-
uses
protected int uses
-
readWriteTimeout
protected int readWriteTimeout
-
connectionTimeout
protected int connectionTimeout
-
debugInfo
protected java.util.List<String> debugInfo
-
debugPrefix
protected String debugPrefix
-
requestFullURL
protected boolean requestFullURL
-
parseDateFormats
protected String[] parseDateFormats
-
sendBufferSize
protected int sendBufferSize
-
receiveBufferSize
protected int receiveBufferSize
-
userAgent
protected String userAgent
-
nonblocked
protected Boolean nonblocked
-
logOptions
protected int logOptions
-
addrIdx
protected int addrIdx
-
isSSL
protected boolean isSSL
-
-
Method Detail
-
getConnectionTimeout
public int getConnectionTimeout()
-
setConnectionTimeout
public void setConnectionTimeout(int connectionTimeout)
-
getRetryTimeout
public long getRetryTimeout()
-
setRetryTimeout
public void setRetryTimeout(long timeout)
-
getSendBufferSize
public int getSendBufferSize()
-
setSendBufferSize
public void setSendBufferSize(int sendBufferSize)
-
getReceiveBufferSize
public int getReceiveBufferSize()
-
setReceiveBufferSize
public void setReceiveBufferSize(int receiveBufferSize)
-
getUserAgent
public String getUserAgent()
-
setUserAgent
public void setUserAgent(String userAgent)
-
getLogOptions
public int getLogOptions()
-
setLogOptions
public void setLogOptions(int options)
-
addLogOptions
public void addLogOptions(int options)
-
removeLogOptions
public void removeLogOptions(int options)
-
isLogOption
public boolean isLogOption(int option)
-
setIsSSL
public void setIsSSL(boolean ssl)
-
getIsSSL
public boolean getIsSSL()
-
setProxyAddress
public void setProxyAddress(String host, int port)
-
close
public void close()
-
connect
public void connect()
-
reconnect
protected void reconnect()
-
isOpen
public boolean isOpen()
-
parseHeader
protected void parseHeader(HTTPByteWriter.SendResult result, byte[] buffer, int offset, int len, boolean isHead)
-
delete
public HTTPByteReaderResult delete(String path)
-
getDeleteCommand
protected void getDeleteCommand(String path)
-
deleteDirect
public HTTPByteReaderResult deleteDirect(String path)
-
write
public HTTPByteReaderResult write(String method, String path, String str)
-
write
public HTTPByteReaderResult write(String method, String path, byte[] buffer, int offset, int len)
-
write
public HTTPByteReaderResult write(String method, String path, PacketFragmentList fragmentList)
-
getPostMessage
protected void getPostMessage(String method, String path, PacketFragmentList fragmentList)
-
writeDirect
public HTTPByteReaderResult writeDirect(String method, String path, PacketFragmentList fragmentList)
-
getRequestPath
protected String getRequestPath(String path, String host, int port)
-
getContextPath
protected String getContextPath()
-
dumpDebug
protected void dumpDebug()
-
sendRequest
public HTTPByteWriter.SendResult sendRequest(byte[] request, boolean isHead)
-
sendRequest
public HTTPByteWriter.SendResult sendRequest(byte[] request, PacketFragmentList fragmentList, int len, boolean isHead)
-
sendRequestBlocked
public HTTPByteWriter.SendResult sendRequestBlocked(byte[] request, PacketFragmentList fragmentList, int len, boolean isHead)
-
sendRequestNonBlocked
public HTTPByteWriter.SendResult sendRequestNonBlocked(byte[] request, PacketFragmentList fragmentList, int len, boolean isHead)
-
getMaxUsesBeforeReconnect
public int getMaxUsesBeforeReconnect()
-
setMaxUsesBeforeReconnect
public void setMaxUsesBeforeReconnect(int maxUsesBeforeReconnect)
-
getMaxRetries
public int getMaxRetries()
-
setMaxRetries
public void setMaxRetries(int maxRetries)
-
getReadWriteTimeout
public int getReadWriteTimeout()
-
setReadWriteTimeout
public void setReadWriteTimeout(int readWriteTimeout)
-
isRequestFullURL
public boolean isRequestFullURL()
-
setRequestFullURL
public void setRequestFullURL(boolean requestFullURL)
-
init
protected boolean init()
-
innerConnect
protected boolean innerConnect()
-
initHandShake
protected void initHandShake() throws java.io.IOException
- Throws:
java.io.IOException
-
socketWrite
protected int socketWrite(java.nio.ByteBuffer reqBuffer) throws java.io.IOException
- Throws:
java.io.IOException
-
socketRead
protected int socketRead(java.nio.ByteBuffer readBuffer) throws java.io.IOException, InterruptedException
- Throws:
java.io.IOException
InterruptedException
-
parseLogOptions
public static int parseLogOptions(String options)
-
-