javax.websocket.ClientEndpoint Java Examples

The following examples show how to use javax.websocket.ClientEndpoint. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ServerWebSocketContainer.java    From quarkus-http with Apache License 2.0 5 votes vote down vote up
private ConfiguredClientEndpoint getClientEndpoint(final Class<?> endpointType, boolean requiresCreation) {
    Class<?> type = endpointType;
    while (type != Object.class && type != null && !type.isAnnotationPresent(ClientEndpoint.class)) {
        type = type.getSuperclass();
    }
    if (type == Object.class || type == null) {
        return null;
    }

    ConfiguredClientEndpoint existing = clientEndpoints.get(type);
    if (existing != null) {
        return existing;
    }
    synchronized (this) {
        existing = clientEndpoints.get(type);
        if (existing != null) {
            return existing;
        }
        if (type.isAnnotationPresent(ClientEndpoint.class)) {
            try {
                addEndpointInternal(type, requiresCreation);
                return clientEndpoints.get(type);
            } catch (DeploymentException e) {
                throw new RuntimeException(e);
            }
        }
        return null;
    }
}
 
Example #2
Source File: WebSocketPlugin.java    From seed with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public Collection<ClasspathScanRequest> classpathScanRequests() {
    if (isEnabled()) {
        return classpathScanRequestBuilder().annotationType(ServerEndpoint.class).annotationType(
                ClientEndpoint.class).build();
    } else {
        return super.classpathScanRequests();
    }
}
 
Example #3
Source File: WebSocketPlugin.java    From seed with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public InitState initialize(InitContext initContext) {
    if (isEnabled()) {
        serverEndpointClasses.addAll(initContext.scannedClassesByAnnotationClass().get(ServerEndpoint.class));
        clientEndpointClasses.addAll(initContext.scannedClassesByAnnotationClass().get(ClientEndpoint.class));
    }
    return InitState.INITIALIZED;
}