Fixing write of byte buffer
This commit is contained in:
parent
ae56940796
commit
84fa1163e9
|
@ -16,7 +16,6 @@ import org.eclipse.jetty.websocket.api.WebSocketException;
|
|||
import org.eclipse.jetty.websocket.api.WebSocketListener;
|
||||
import org.eclipse.jetty.websocket.api.WebSocketPolicy;
|
||||
import org.eclipse.jetty.websocket.frames.BaseFrame;
|
||||
import org.eclipse.jetty.websocket.frames.BinaryFrame;
|
||||
import org.eclipse.jetty.websocket.frames.CloseFrame;
|
||||
import org.eclipse.jetty.websocket.frames.DataFrame;
|
||||
import org.eclipse.jetty.websocket.io.MessageInputStream;
|
||||
|
@ -277,24 +276,6 @@ public class WebSocketEventDriver implements Parser.Listener
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Specified Binary Case
|
||||
if ((frame instanceof BinaryFrame) && (events.onBinary != null))
|
||||
{
|
||||
BinaryFrame bin = (BinaryFrame)frame;
|
||||
if (events.onBinary.isStreaming())
|
||||
{
|
||||
// Streaming Approach
|
||||
}
|
||||
else
|
||||
{
|
||||
// Byte array approach
|
||||
byte buf[] = BufferUtil.toArray(bin.getPayload());
|
||||
events.onBinary.call(websocket,connection,buf,0,buf.length);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
|
|
|
@ -33,7 +33,7 @@ public class BinaryFrame extends DataFrame
|
|||
public BinaryFrame(byte[] data, int offset, int length)
|
||||
{
|
||||
this();
|
||||
setPayload(ByteBuffer.wrap(data,offset,length));
|
||||
setPayload(data,offset,length);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -135,6 +135,8 @@ public class Parser
|
|||
{
|
||||
throw new ProtocolException("Fragment continuation frame without prior !FIN");
|
||||
}
|
||||
// Be careful to use the original opcode
|
||||
opcode = parser.getFrame().getOpCode();
|
||||
}
|
||||
|
||||
if (parser == null)
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
org.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StdErrLog
|
||||
org.eclipse.jetty.io.LEVEL=DEBUG
|
||||
org.eclipse.jetty.io.LEVEL=INFO
|
||||
org.eclipse.jetty.io.SelectorManager.LEVEL=INFO
|
||||
org.eclipse.jetty.websocket.LEVEL=DEBUG
|
||||
org.eclipse.jetty.websocket.generator.LEVEL=DEBUG
|
||||
org.eclipse.jetty.websocket.server.blockhead.LEVEL=DEBUG
|
Loading…
Reference in New Issue