protected void assertIsReturn(Method method, Class<?> type) { if (!type.equals(method.getReturnType())) { StringBuilder err = new StringBuilder(); err.append("Invalid declaration of "); err.append(method); err.append(System.lineSeparator()); err.append("Return type must be ").append(type); throw new InvalidWebSocketException(err.toString()); } }
private void assertIsReturn(Method method, Class<?> type) { if (!type.equals(method.getReturnType())) { StringBuilder err = new StringBuilder(); err.append("Invalid declaration of "); err.append(method); err.append(StringUtil.__LINE_SEPARATOR); err.append("Return type must be ").append(type); throw new InvalidWebSocketException(err.toString()); } }
private void assertIsReturn(Method method, Class<?> type) { if (!type.equals(method.getReturnType())) { StringBuilder err = new StringBuilder(); err.append("Invalid declaration of "); err.append(method); err.append(StringUtil.__LINE_SEPARATOR); err.append("Return type must be ").append(type); throw new InvalidWebSocketException(err.toString()); } }
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()); } }
protected void assertUnset(CallableMethod callable, Class<? extends Annotation> annoClass, Method method) { if (callable != 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(System.lineSeparator()); err.append("@").append(annoClass.getSimpleName()).append(" previously declared at "); err.append(callable.getMethod()); throw new InvalidWebSocketException(err.toString()); } }
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()); } }
private WebSocketSession createSession(URI requestURI, EventDriver websocket, LogicalConnection connection) { if (websocket == null) { throw new InvalidWebSocketException("Unable to create Session from null websocket"); } for (SessionFactory impl : sessionFactories) { if (impl.supports(websocket)) { try { return impl.createSession(requestURI, websocket, connection); } catch (Throwable e) { throw new InvalidWebSocketException("Unable to create Session", e); } } } throw new InvalidWebSocketException("Unable to create Session: unrecognized internal EventDriver type: " + websocket.getClass().getName()); }
public EventMethods getMethods(Class<?> pojo) throws InvalidWebSocketException { if (pojo == null) { throw new InvalidWebSocketException("Cannot get methods for null class"); } if (cache.containsKey(pojo)) { return cache.get(pojo); } EventMethods methods = discoverMethods(pojo); if (methods == null) { return null; } cache.put(pojo,methods); return methods; }
private void assertIsPublicNonStatic(Method method) { int mods = method.getModifiers(); if (!Modifier.isPublic(mods)) { StringBuilder err = new StringBuilder(); err.append("Invalid declaration of "); err.append(method); err.append(StringUtil.__LINE_SEPARATOR); err.append("Method modifier must be public"); throw new InvalidWebSocketException(err.toString()); } if (Modifier.isStatic(mods)) { StringBuilder err = new StringBuilder(); err.append("Invalid declaration of "); err.append(method); err.append(StringUtil.__LINE_SEPARATOR); err.append("Method modifier may not be static"); throw new InvalidWebSocketException(err.toString()); } }
protected void assertIsPublicNonStatic(Method method) { int mods = method.getModifiers(); if (!Modifier.isPublic(mods)) { StringBuilder err = new StringBuilder(); err.append("Invalid declaration of "); err.append(method); err.append(System.lineSeparator()); err.append("Method modifier must be public"); throw new InvalidWebSocketException(err.toString()); } if (Modifier.isStatic(mods)) { StringBuilder err = new StringBuilder(); err.append("Invalid declaration of "); err.append(method); err.append(System.lineSeparator()); err.append("Method modifier may not be static"); throw new InvalidWebSocketException(err.toString()); } }
private void assertIsPublicNonStatic(Method method) { int mods = method.getModifiers(); if (!Modifier.isPublic(mods)) { StringBuilder err = new StringBuilder(); err.append("Invalid declaration of "); err.append(method); err.append(StringUtil.__LINE_SEPARATOR); err.append("Method modifier must be public"); throw new InvalidWebSocketException(err.toString()); } if (Modifier.isStatic(mods)) { StringBuilder err = new StringBuilder(); err.append("Invalid declaration of "); err.append(method); err.append(StringUtil.__LINE_SEPARATOR); err.append("Method modifier may not be static"); throw new InvalidWebSocketException(err.toString()); } }
public EventMethods getMethods(Class<?> pojo) throws InvalidWebSocketException { if (pojo == null) { throw new InvalidWebSocketException("Cannot get methods for null class"); } if (cache.containsKey(pojo)) { return cache.get(pojo); } EventMethods methods = discoverMethods(pojo); if (methods == null) { return null; } cache.put(pojo,methods); return methods; }
throw new InvalidWebSocketException("null websocket object"); throw new InvalidWebSocketException("Unable to create websocket",e); throw new InvalidWebSocketException(err.toString());
throw new InvalidWebSocketException("null websocket object"); throw new InvalidWebSocketException(websocket.getClass().getName() + " does not implement " + WebSocketListener.class.getName() + " or declare @WebSocket");
throw new InvalidWebSocketException("null websocket object"); throw new InvalidWebSocketException(websocket.getClass().getName() + " does not implement " + WebSocketListener.class.getName() + " or declare @WebSocket");
private ServerEndpointConfig createEndpointConfig(Class<?> endpointClass) throws DeploymentException { ServerEndpoint annotation = endpointClass.getAnnotation(ServerEndpoint.class); if (annotation == null) { throw new InvalidWebSocketException("Unsupported WebSocket object, missing @" + ServerEndpoint.class + " annotation"); } return ServerEndpointConfig.Builder.create(endpointClass, annotation.value()) .subprotocols(Arrays.asList(annotation.subprotocols())) .decoders(Arrays.asList(annotation.decoders())) .encoders(Arrays.asList(annotation.encoders())) .configurator(configurator) .build(); }
protected AnnotatedServerEndpointMetadata(WebSocketContainerScope containerScope, Class<?> websocket, ServerEndpointConfig baseConfig) throws DeploymentException { super(websocket); ServerEndpoint anno = websocket.getAnnotation(ServerEndpoint.class); if (anno == null) { throw new InvalidWebSocketException("Unsupported WebSocket object, missing @" + ServerEndpoint.class + " annotation"); } this.endpoint = anno; this.config = new AnnotatedServerEndpointConfig(containerScope,websocket,anno,baseConfig); getDecoders().addAll(anno.decoders()); getEncoders().addAll(anno.encoders()); }