|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.caucho.server.connection.AbstractHttpRequest
com.caucho.server.hmux.HmuxRequest
public class HmuxRequest
Handles requests from a remote dispatcher. For example, mod_caucho and the IIS plugin use this protocol to talk to the backend.
Packets are straightforward:
code l2 l1 l0 contentsWhere code is the code of the packet and l2-0 give 12 bits of length.
The protocol is designed to allow pipelining and buffering whenever possible. So most commands are not acked. Data from the frontend (POST) does need acks to prevent deadlocks at either end while waiting for new data.
The overriding protocol is controlled by requests from the frontend server.
A ping request:
Frontend Backend
CSE_PING
CSE_END
CSE_END
A GET request:
Frontend Backend
CSE_METHOD
...
CSE_HEADER/CSE_VALUE
CSE_END
CSE_DATA
CSE_DATA
CSE_END
Short POST:
Frontend Backend
CSE_METHOD
...
CSE_HEADER/CSE_VALUE
CSE_DATA
CSE_END
CSE_DATA
CSE_DATA
CSE_END
Long POST:
Frontend Backend
CSE_METHOD
...
CSE_HEADER/CSE_VALUE
CSE_DATA
CSE_DATA (optional)
CSE_DATA
CSE_ACK
CSE_DATA (optional)
CSE_DATA
CSE_ACK
CSE_END
CSE_DATA
CSE_END
| Nested Class Summary | |
|---|---|
static class |
HmuxRequest.ProtocolResult
|
| Fields inherited from class com.caucho.server.connection.AbstractHttpRequest |
|---|
_calendar, _cb, _conn, _expect100Continue, _hasReadStream, _headerCodes, _hostHeader, _invocation, _rawRead, _readStream, _response, _sessionGroup, _tcpConn, CONTEXT_PATH, ERROR_URI, EXCEPTION, EXCEPTION_TYPE, JSP_EXCEPTION, MESSAGE, PATH_INFO, QUERY_STRING, REQUEST_URI, SERVLET_NAME, SERVLET_PATH, SHUTDOWN, STATUS_CODE |
| Fields inherited from interface javax.servlet.http.HttpServletRequest |
|---|
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH |
| Constructor Summary | |
|---|---|
HmuxRequest(DispatchServer server,
Connection conn,
HmuxProtocol protocol)
|
|
| Method Summary | |
|---|---|
protected boolean |
checkLogin()
|
protected void |
connectionClose()
Called for a connection: close |
java.lang.String |
dbgId()
|
java.lang.String |
getHeader(java.lang.String key)
Returns the header. |
CharSegment |
getHeaderBuffer(char[] buf,
int length)
|
CharSegment |
getHeaderBuffer(java.lang.String key)
Fills the result with the header values as CharSegment values. |
void |
getHeaderBuffers(java.lang.String key,
java.util.ArrayList<CharSegment> values)
Fills the result with a list of the header values as CharSegment values. |
java.util.Enumeration |
getHeaderNames()
Enumerates the header keys |
protected CharBuffer |
getHost()
Returns a char buffer containing the host. |
java.lang.String |
getMethod()
Returns the header. |
CharSegment |
getMethodBuffer()
|
java.lang.String |
getProtocol()
Returns the protocol. |
CharSegment |
getProtocolBuffer()
|
java.lang.String |
getRemoteAddr()
Returns the IP address of the remote host, i.e. |
void |
getRemoteAddr(CharBuffer cb)
|
java.lang.String |
getRemoteHost()
Returns the DNS hostname of the remote host, i.e. |
java.lang.String |
getRequestURI()
Returns the URI for the request, special casing the IIS issues. |
java.lang.String |
getServerName()
Returns the server name. |
int |
getServerPort()
Returns the server's port. |
byte[] |
getUriBuffer()
|
int |
getUriLength()
|
boolean |
handleRequest()
Handles a new request. |
protected boolean |
initStream(ReadStream readStream,
ReadStream rawStream)
Initialize the read stream from the raw stream. |
boolean |
isSecure()
Returns true if the request is secure. |
boolean |
isTop()
Returns true for the top-level request, but false for any include() or forward() |
boolean |
isWaitForRead()
Return true if the connection should wait for a read before handling the request. |
int |
printRemoteAddr(byte[] buffer,
int offset)
|
void |
protocolCloseEvent()
Handles a close event when the connection is closed. |
void |
setHeader(java.lang.String key,
java.lang.String value)
Sets the header. |
protected void |
start()
Clears variables at the start of a new request. |
void |
startConnection()
Called when the connection starts. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface com.caucho.server.port.ServerRequest |
|---|
handleResume, init |
| Field Detail |
|---|
public static final int HMUX_CHANNEL
public static final int HMUX_ACK
public static final int HMUX_ERROR
public static final int HMUX_YIELD
public static final int HMUX_QUIT
public static final int HMUX_EXIT
public static final int HMUX_DATA
public static final int HMUX_URI
public static final int HMUX_STRING
public static final int HMUX_HEADER
public static final int HMUX_BINARY
public static final int HMUX_PROTOCOL
public static final int HMUX_META_HEADER
public static final int CSE_NULL
public static final int CSE_PATH_INFO
public static final int CSE_PROTOCOL
public static final int CSE_REMOTE_USER
public static final int CSE_QUERY_STRING
public static final int HMUX_FLUSH
public static final int CSE_SERVER_PORT
public static final int CSE_REMOTE_HOST
public static final int CSE_REMOTE_ADDR
public static final int CSE_REMOTE_PORT
public static final int CSE_REAL_PATH
public static final int CSE_SCRIPT_FILENAME
public static final int HMUX_METHOD
public static final int CSE_AUTH_TYPE
public static final int CSE_URI
public static final int CSE_CONTENT_LENGTH
public static final int CSE_CONTENT_TYPE
public static final int CSE_IS_SECURE
public static final int HMUX_STATUS
public static final int CSE_CLIENT_CERT
public static final int CSE_SERVER_TYPE
public static final int HMUX_SERVER_NAME
public static final int CSE_SEND_HEADER
public static final int CSE_DATA
public static final int CSE_FLUSH
public static final int CSE_KEEPALIVE
public static final int CSE_ACK
public static final int CSE_END
public static final int CSE_CLOSE
public static final int CSE_QUERY
public static final int CSE_PING
public static final int HMTP_MESSAGE
public static final int HMTP_QUERY_GET
public static final int HMTP_QUERY_SET
public static final int HMTP_QUERY_RESULT
public static final int HMTP_ERROR
public static final int HMTP_PACKET
public static final int HMUX_CLUSTER_PROTOCOL
public static final int HMUX_DISPATCH_PROTOCOL
public static final int HMUX_JMS_PROTOCOL
| Constructor Detail |
|---|
public HmuxRequest(DispatchServer server,
Connection conn,
HmuxProtocol protocol)
| Method Detail |
|---|
public boolean isWaitForRead()
ServerRequest
isWaitForRead in interface ServerRequestpublic void startConnection()
startConnection in interface ServerRequeststartConnection in class AbstractHttpRequest
public boolean handleRequest()
throws java.io.IOException
Note: ClientDisconnectException must be rethrown to the caller.
handleRequest in interface ServerRequestjava.io.IOException
protected boolean initStream(ReadStream readStream,
ReadStream rawStream)
throws java.io.IOException
initStream in class AbstractHttpRequestjava.io.IOExceptionpublic boolean isTop()
isTop in interface CauchoRequestisTop in class AbstractHttpRequestprotected boolean checkLogin()
protected void start()
throws java.io.IOException
start in class AbstractHttpRequestjava.io.IOExceptionpublic java.lang.String getMethod()
getMethod in interface HttpServletRequestgetMethod in class AbstractHttpRequestpublic CharSegment getMethodBuffer()
protected CharBuffer getHost()
getHost in class AbstractHttpRequestpublic final byte[] getUriBuffer()
getUriBuffer in class AbstractHttpRequestpublic final int getUriLength()
getUriLength in class AbstractHttpRequestpublic java.lang.String getProtocol()
getProtocol in interface ServletRequestgetProtocol in class AbstractHttpRequestpublic CharSegment getProtocolBuffer()
public boolean isSecure()
isSecure in interface ServletRequestisSecure in class AbstractHttpRequestpublic java.lang.String getHeader(java.lang.String key)
getHeader in interface HttpServletRequestgetHeader in class AbstractHttpRequestkey - the header key
public CharSegment getHeaderBuffer(java.lang.String key)
AbstractHttpRequest
getHeaderBuffer in class AbstractHttpRequestkey - the header name
public CharSegment getHeaderBuffer(char[] buf,
int length)
public void setHeader(java.lang.String key,
java.lang.String value)
AbstractHttpRequest
setHeader in interface CauchoRequestsetHeader in class AbstractHttpRequest
public void getHeaderBuffers(java.lang.String key,
java.util.ArrayList<CharSegment> values)
AbstractHttpRequest
getHeaderBuffers in class AbstractHttpRequestkey - the header namevalues - the resulting bufferpublic java.util.Enumeration getHeaderNames()
AbstractHttpRequest
getHeaderNames in interface HttpServletRequestgetHeaderNames in class AbstractHttpRequestpublic java.lang.String getRequestURI()
getRequestURI in interface HttpServletRequestgetRequestURI in class AbstractHttpRequestpublic java.lang.String getServerName()
getServerName in interface ServletRequestgetServerName in class AbstractHttpRequestpublic int getServerPort()
AbstractHttpRequest
getServerPort in interface ServletRequestgetServerPort in class AbstractHttpRequestpublic java.lang.String getRemoteAddr()
ServletRequest
getRemoteAddr in interface ServletRequestgetRemoteAddr in class AbstractHttpRequestpublic void getRemoteAddr(CharBuffer cb)
public int printRemoteAddr(byte[] buffer,
int offset)
throws java.io.IOException
printRemoteAddr in class AbstractHttpRequestjava.io.IOExceptionpublic java.lang.String getRemoteHost()
ServletRequest
getRemoteHost in interface ServletRequestgetRemoteHost in class AbstractHttpRequestprotected void connectionClose()
connectionClose in class AbstractHttpRequestpublic void protocolCloseEvent()
ServerRequest
protocolCloseEvent in interface ServerRequestpublic final java.lang.String dbgId()
dbgId in class AbstractHttpRequestpublic java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||