Java Reference
In-Depth Information
public void onDataAvailable() throws
IOException {
byte b[] = new byte[3072];
int data =;
while (input.isReady() && data != -1) {
data =;
public void onAllDataRead() throws
IOException {
public void onError(Throwable t) {
System.out.println("onError : " +
Protocol upgrade processing
Protocol upgrade processing is a mechanism that was introduced in HTTP 1.1 to
provide the possibility of switching from HTTP protocol to another (one that is com-
pletely different). A concrete example of protocol upgrade processing usage is the
migration from HTTP protocol to the WebSocket protocol where the client begins
by sending a request for WebSocket to the server. The client request is sent via
HTTP and if the server accepts the connection request, it will still respond through
HTTP. From this moment, every other communication will be through the estab-
lished WebSocket channel. Support for this mechanism in the Servlet 3.1 Spe-
cification was done by adding the upgrade method to HttpServletRequest
and two new interfaces: javax.servlet.http.HttpUpgradeHandler and
javax.servlet.http.WebConnection .
Search WWH ::

Custom Search