JSR-356 Improving Debugging of Annotated EventDrivers

This commit is contained in:
Joakim Erdfelt 2013-07-15 15:58:37 -07:00
parent 2f01bdcdec
commit 9a8580b580
2 changed files with 21 additions and 2 deletions

View File

@ -144,15 +144,22 @@ public class JsrAnnotatedEventDriver extends AbstractJsrEventDriver implements E
@Override @Override
public void onBinaryMessage(byte[] data) public void onBinaryMessage(byte[] data)
{ {
if (data == null)
{
return;
}
ByteBuffer buf = ByteBuffer.wrap(data);
if (LOG.isDebugEnabled()) if (LOG.isDebugEnabled())
{ {
LOG.debug("onBinary({})",data); LOG.debug("onBinaryMessage({})",BufferUtil.toDetailString(buf));
} }
try try
{ {
// FIN is always true here // FIN is always true here
events.callBinary(jsrsession.getAsyncRemote(),websocket,ByteBuffer.wrap(data),true); events.callBinary(jsrsession.getAsyncRemote(),websocket,buf,true);
} }
catch (DecodeException e) catch (DecodeException e)
{ {

View File

@ -83,4 +83,16 @@ public class AnnotatedServerEndpointMetadata extends AnnotatedEndpointMetadata<S
{ {
return config.getPath(); return config.getPath();
} }
@Override
public String toString()
{
StringBuilder builder = new StringBuilder();
builder.append("AnnotatedServerEndpointMetadata[endpoint=");
builder.append(endpoint);
builder.append(",config=");
builder.append(config);
builder.append("]");
return builder.toString();
}
} }