.create( WSQueryEndpoint.class, WSQueryEndpoint.class.getAnnotation(ServerEndpoint.class).value()
ServerEndpoint annotation = endpoint.getAnnotation(ServerEndpoint.class); if (annotation != null) { String path = annotation.value(); addManagementWebsocket(deploymentUnit, endpoint, path);
/** * Extract the URI from the endpoint. * <b>Note that it is better use validateEndpointUri method to validate the endpoint uri * before getting it out if needed. Otherwise it will cause issues. Use this method only and only if * it is sure that endpoint contains {@link ServerEndpoint} defined.</b> * * @param webSocketEndpoint WebSocket endpoint which the URI should be extracted. * @return the URI of the Endpoint as a String. */ public String getUri(Object webSocketEndpoint) { return webSocketEndpoint.getClass().getAnnotation(ServerEndpoint.class).value(); }
/** * Extract the URI from the endpoint. * <b>Note that it is better use validateEndpointUri method to validate the endpoint uri * before getting it out if needed. Otherwise it will cause issues. Use this method only and only if * it is sure that endpoint contains {@link ServerEndpoint} defined.</b> * * @param webSocketEndpoint WebSocket endpoint which the URI should be extracted. * @return the URI of the Endpoint as a String. */ public String getUri(Object webSocketEndpoint) { return webSocketEndpoint.getClass().getAnnotation(ServerEndpoint.class).value(); }
/** * Get the {@link URI} for the {@link ServerEndpoint} annotated class. * * @param serverClass the annotated class the {@link URI} is computed for. * @param scheme scheme of newly created {@link URI}. If {@code null}, "ws" will be used. * @return {@link URI} which is used to connect to the given endpoint. */ protected URI getURI(Class<?> serverClass, String scheme) { String endpointPath = serverClass.getAnnotation(ServerEndpoint.class).value(); return getURI(endpointPath, scheme); }
/** * Get the {@link URI} for the {@link ServerEndpoint} annotated class. * * @param serverClass the annotated class the {@link URI} is computed for. * @param scheme scheme of newly created {@link URI}. If {@code null}, "ws" will be used. * @return {@link URI} which is used to connect to the given endpoint. */ protected URI getURI(Class<?> serverClass, String scheme) { String endpointPath = serverClass.getAnnotation(ServerEndpoint.class).value(); return getURI(endpointPath, scheme); }
private JbootWebsocketManager() { List<Class> endPointClasses = ClassScanner.scanClassByAnnotation(ServerEndpoint.class, false); if (endPointClasses != null && endPointClasses.size() != 0) { for (Class entry : endPointClasses) { ServerEndpoint serverEndpoint = (ServerEndpoint) entry.getAnnotation(ServerEndpoint.class); String value = serverEndpoint.value(); if (!StrUtils.isBlank(value)) { websocketEndPoints.add(entry); websocketEndPointValues.add(value); } } } }
public void addEndpoint(Class<?> clazz) { ServerEndpoint anno = clazz.getAnnotation(ServerEndpoint.class); if(anno == null){ throw new RuntimeException(clazz.getCanonicalName()+" does not have a "+ServerEndpoint.class.getCanonicalName()+" annotation"); } ServerEndpointConfig.Builder bldr = ServerEndpointConfig.Builder.create(clazz, anno.value()); if(defaultConfigurator != null){ bldr = bldr.configurator(defaultConfigurator); } endpointConfigs.add(bldr.build()); if (starting) throw new RuntimeException("can't add endpoint after starting lifecycle"); }
public void addEndpoint(Class<?> clazz) { ServerEndpoint anno = clazz.getAnnotation(ServerEndpoint.class); if(anno == null){ throw new RuntimeException(clazz.getCanonicalName()+" does not have a "+ServerEndpoint.class.getCanonicalName()+" annotation"); } ServerEndpointConfig.Builder bldr = ServerEndpointConfig.Builder.create(clazz, anno.value()); if(defaultConfigurator != null){ bldr = bldr.configurator(defaultConfigurator); } endpointConfigs.add(bldr.build()); if (starting) throw new RuntimeException("can't add endpoint after starting lifecycle"); }
ServerEndpoint annotation = endpoint.getAnnotation(ServerEndpoint.class); if (annotation != null) { String path = annotation.value(); addManagementWebsocket(deploymentUnit, endpoint, path);
ServerEndpoint annotation = endpoint.getAnnotation(ServerEndpoint.class); if (annotation != null) { String path = annotation.value(); addManagementWebsocket(deploymentUnit, endpoint, path);
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(); }
/** * Provides the equivalent of {@link #addEndpoint(ServerEndpointConfig)} for publishing plain old java objects (POJOs) that have been annotated as WebSocket endpoints. * * @param pojo * The annotated POJO */ @Override public void addEndpoint(Class<?> pojo) throws DeploymentException { log.debug("addEndpoint: {}", pojo); ServerEndpoint annotation = pojo.getAnnotation(ServerEndpoint.class); if (annotation == null) { throw new DeploymentException(sm.getString("serverContainer.missingAnnotation", pojo.getName())); } String path = annotation.value(); // Validate encoders validateEncoders(annotation.encoders()); // ServerEndpointConfig ServerEndpointConfig sec; Class<? extends Configurator> configuratorClazz = annotation.configurator(); Configurator configurator = null; if (!configuratorClazz.equals(Configurator.class)) { try { configurator = annotation.configurator().getConstructor().newInstance(); } catch (ReflectiveOperationException e) { throw new DeploymentException(sm.getString("serverContainer.configuratorFail", annotation.configurator().getName(), pojo.getClass().getName()), e); } } sec = ServerEndpointConfig.Builder.create(pojo, path).decoders(Arrays.asList(annotation.decoders())).encoders(Arrays.asList(annotation.encoders())).subprotocols(Arrays.asList(annotation.subprotocols())).configurator(configurator).build(); addEndpoint(sec); }
pojo.getName())); String path = annotation.value();
pojo.getName())); String path = annotation.value();
pojo.getName())); String path = annotation.value();
TyrusServerEndpointConfig.Builder builder = TyrusServerEndpointConfig.Builder .create(annotatedClass, wseAnnotation.value()) .encoders(encoderClasses) .decoders(decoderClasses) ServerEndpointConfig.Builder builder = ServerEndpointConfig.Builder .create(annotatedClass, wseAnnotation.value()) .encoders(encoderClasses) .decoders(decoderClasses)
throw new DeploymentException(MESSAGES.cannotDeployPojo(pojo.getName())); String path = annotation.value();
TyrusServerEndpointConfig.Builder builder = TyrusServerEndpointConfig.Builder .create(annotatedClass, wseAnnotation.value()) .encoders(encoderClasses) .decoders(decoderClasses) ServerEndpointConfig.Builder builder = ServerEndpointConfig.Builder .create(annotatedClass, wseAnnotation.value()) .encoders(encoderClasses) .decoders(decoderClasses)
pojo.getName())); String path = annotation.value();