use of org.eclipse.jetty.websocket.api.WebSocketException in project jetty.project by eclipse.
the class Parser method parse.
public void parse(ByteBuffer buffer) throws WebSocketException {
if (buffer.remaining() <= 0) {
return;
}
try {
// parse through all the frames in the buffer
while (parseFrame(buffer)) {
if (LOG.isDebugEnabled())
LOG.debug("{} Parsed Frame: {}", policy.getBehavior(), frame);
notifyFrame(frame);
if (frame.isDataFrame()) {
priorDataFrame = !frame.isFin();
}
reset();
}
} catch (WebSocketException e) {
// consume remaining
buffer.position(buffer.limit());
reset();
// let session know
notifyWebSocketException(e);
// need to throw for proper close behavior in connection
throw e;
} catch (Throwable t) {
// consume remaining
buffer.position(buffer.limit());
reset();
// let session know
WebSocketException e = new WebSocketException(t);
notifyWebSocketException(e);
// need to throw for proper close behavior in connection
throw e;
}
}
Aggregations