@Override public void onConnect() { if (events.onConnect != null) { events.onConnect.call(websocket,session); } }
public EventMethod(Class<?> pojo, Method method) { this.pojo = pojo; this.paramTypes = method.getParameterTypes(); this.method = method; identifyPresentParamTypes(); }
Object trimArgs[] = dropFirstArg(args); call(obj,trimArgs); return;
@Override public void onBinaryFrame(ByteBuffer buffer, boolean fin) throws IOException { if (events.onBinary == null) { // not interested in binary events return; } if (activeMessage == null) { if (events.onBinary.isStreaming()) { activeMessage = new MessageInputStream(this); } else { activeMessage = new SimpleBinaryMessage(this); } } activeMessage.appendMessage(buffer); if (fin) { activeMessage.messageComplete(); activeMessage = null; } }
private void assertUnset(EventMethod event, Class<? extends Annotation> annoClass, Method method) { if (event != null) { // Attempt to add duplicate frame type (a no-no) StringBuilder err = new StringBuilder(); err.append("Duplicate @").append(annoClass.getSimpleName()).append(" declaration on "); err.append(method); err.append(StringUtil.__LINE_SEPARATOR); err.append("@").append(annoClass.getSimpleName()).append(" previously declared at "); err.append(event.getMethod()); throw new InvalidWebSocketException(err.toString()); } }
events.onConnect = new EventMethod(pojo,method); continue; events.onText = new EventMethod(pojo,method); continue; events.onBinary = new EventMethod(pojo,method); continue; events.onClose = new EventMethod(pojo,method); continue; events.onError = new EventMethod(pojo,method); continue; events.onFrame = new EventMethod(pojo,method); continue;
Object trimArgs[] = dropFirstArg(args); call(obj,trimArgs); return;
@Override public void onBinaryFrame(ByteBuffer buffer, boolean fin) throws IOException { if (events.onBinary == null) { // not interested in binary events return; } if (activeMessage == null) { if (events.onBinary.isStreaming()) { activeMessage = new MessageInputStream(this); } else { activeMessage = new SimpleBinaryMessage(this); } } activeMessage.appendMessage(buffer); if (fin) { activeMessage.messageComplete(); activeMessage = null; } }
private void assertUnset(EventMethod event, Class<? extends Annotation> annoClass, Method method) { if (event != null) { // Attempt to add duplicate frame type (a no-no) StringBuilder err = new StringBuilder(); err.append("Duplicate @").append(annoClass.getSimpleName()).append(" declaration on "); err.append(method); err.append(StringUtil.__LINE_SEPARATOR); err.append("@").append(annoClass.getSimpleName()).append(" previously declared at "); err.append(event.getMethod()); throw new InvalidWebSocketException(err.toString()); } }
events.onConnect = new EventMethod(pojo,method); continue; events.onText = new EventMethod(pojo,method); continue; events.onBinary = new EventMethod(pojo,method); continue; events.onClose = new EventMethod(pojo,method); continue; events.onError = new EventMethod(pojo,method); continue; events.onFrame = new EventMethod(pojo,method); continue;
public void onInputStream(InputStream stream) { if (events.onBinary != null) { events.onBinary.call(websocket,session,stream); } }
public EventMethod(Class<?> pojo, Method method) { this.pojo = pojo; this.paramTypes = method.getParameterTypes(); this.method = method; identifyPresentParamTypes(); }
@Override public void onTextFrame(ByteBuffer buffer, boolean fin) throws IOException { if (events.onText == null) { // not interested in text events return; } if (activeMessage == null) { if (events.onText.isStreaming()) { activeMessage = new MessageReader(this); } else { activeMessage = new SimpleTextMessage(this); } } activeMessage.appendMessage(buffer); if (fin) { activeMessage.messageComplete(); activeMessage = null; } }
public void onInputStream(InputStream stream) { if (events.onBinary != null) { events.onBinary.call(websocket,session,stream); } }
public EventMethod(Class<?> pojo, String methodName, Class<?>... paramTypes) { try { this.pojo = pojo; this.paramTypes = paramTypes; this.method = pojo.getMethod(methodName,paramTypes); identifyPresentParamTypes(); } catch (NoSuchMethodException | SecurityException e) { LOG.warn("Cannot use method {}({}): {}",methodName,paramTypes,e.getMessage()); this.method = null; } }
@Override public void onTextFrame(ByteBuffer buffer, boolean fin) throws IOException { if (events.onText == null) { // not interested in text events return; } if (activeMessage == null) { if (events.onText.isStreaming()) { activeMessage = new MessageReader(this); } else { activeMessage = new SimpleTextMessage(this); } } activeMessage.appendMessage(buffer); if (fin) { activeMessage.messageComplete(); activeMessage = null; } }
@Override public void onFrame(Frame frame) { if (events.onFrame != null) { events.onFrame.call(websocket,session,frame); } }
public EventMethod(Class<?> pojo, String methodName, Class<?>... paramTypes) { try { this.pojo = pojo; this.paramTypes = paramTypes; this.method = pojo.getMethod(methodName,paramTypes); identifyPresentParamTypes(); } catch (NoSuchMethodException | SecurityException e) { LOG.warn("Cannot use method {}({}): {}",methodName,paramTypes,e.getMessage()); this.method = null; } }
@Override public void onBinaryMessage(byte[] data) { if (events.onBinary != null) { events.onBinary.call(websocket,session,data,0,data.length); } }
@Override public void onFrame(Frame frame) { if (events.onFrame != null) { events.onFrame.call(websocket,session,frame); } }