Adds a WebSocket handler on the specified path with the specified roles.
Requires an access manager to be set on the instance.

@see AccessManager
@see <a href="https://javalin.io/documentation#websockets">WebSockets in docs</a>
555711
public Javalin ws(@NotNull String path, @NotNull Consumer<WsHandler> ws, @NotNull Set<Role> permittedRoles) {
        return addWsHandler(WsHandlerType.WEBSOCKET, path, ws, permittedRoles);
    }
1231226
public void addPermission(String path) {
        if (path == null) {
            return;
        }

        if (securityManager != null) {
            Permission permission = null;
            if( path.startsWith("jndi:") || path.startsWith("jar:jndi:") ) {
                if (!path.endsWith("/")) {
                    path = path + "/";
                }
                permission = new JndiPermission(path + "*");
                addPermission(permission);
            } else {
                if (!path.endsWith(File.separator)) {
                    permission = new FilePermission(path, "read");
                    addPermission(permission);
                    path = path + File.separator;
                }
                permission = new FilePermission(path + "-", "read");
                addPermission(permission);
            }
        }
    }
570772
protected boolean register(String path, List<String> vhosts, HttpHandler handler) {
        return pathology.add(path, vhosts, handler);
    }
232517
public Javalin head(@NotNull String path, @NotNull Handler handler, @NotNull Set<Role> permittedRoles) {
        return addHandler(HandlerType.HEAD, path, handler, permittedRoles);
    }
1019494
def add_get(self, path: str, handler: _WebHandler, *,
                name: Optional[str]=None, allow_head: bool=True,
                **kwargs: Any) -> AbstractRoute:
        
        resource = self.add_resource(path, name=name)
        if allow_head:
            resource.add_route(hdrs.METH_HEAD, handler, **kwargs)
        return resource.add_route(hdrs.METH_GET, handler, **kwargs)
1102266
public Javalin put(@NotNull String path, @NotNull Handler handler, @NotNull Set<Role> permittedRoles) {
        return addHandler(HandlerType.PUT, path, handler, permittedRoles);
    }
865089
public void addListener(IWebSocketDataListener listener, String path) {
        log.trace("addListener: {}", listener);
        WebSocketScope scope = getScope(path);
        if (scope != null) {
            scope.addListener(listener);
        } else {
            log.info("Scope not found for path: {}", path);
        }
    }
1228721
public void addClasspath(final String path) {
        AccessController.doPrivileged(new PrivilegedAction<Void>() {
            public Void run() {

                URI newURI;
                try {
                    newURI = new URI(path);
                    // check if we can create a URL from that URI
                    newURI.toURL();
                } catch (URISyntaxException | IllegalArgumentException | MalformedURLException e) {
                    // the URI has a false format, so lets try it with files ...
                    newURI=new File(path).toURI();
                }

                URL[] urls = getURLs();
                for (URL url : urls) {
                    // Do not use URL.equals.  It uses the network to resolve names and compares ip addresses!
                    // That is a violation of RFC and just plain evil.
                    // http://michaelscharf.blogspot.com/2006/11/javaneturlequals-and-hashcode-make.html
                    // http://docs.oracle.com/javase/7/docs/api/java/net/URL.html#equals(java.lang.Object)
                    // "Since hosts comparison requires name resolution, this operation is a blocking operation.
                    // Note: The defined behavior for equals is known to be inconsistent with virtual hosting in HTTP."
                    try {
                        if (newURI.equals(url.toURI())) return null;
                    } catch (URISyntaxException e) {
                        // fail fast! if we got a malformed URI the Classloader has to tell it
                        throw new RuntimeException( e );
                    }
                }
                try {
                    addURL(newURI.toURL());
                } catch (MalformedURLException e) {
                    // fail fast! if we got a malformed URL the Classloader has to tell it
                    throw new RuntimeException( e );
                }
                return null;
            }
        });
    }
110697
@Nonnull
  public final HandlerRegistration addMessageHandler( @Nonnull final MessageEvent.Handler handler )
  {
    return _eventBus.addHandler( MessageEvent.getType(), handler );
  }
714065
protected void addContext(String pathSpec, String dir, boolean isFiltered) throws IOException {
    if (0 == webServer.getHandlers().length) {
      throw new RuntimeException("Couldn't find handler");
    }
    WebAppContext webAppCtx = new WebAppContext();
    webAppCtx.setContextPath(pathSpec);
    webAppCtx.setWar(dir);
    addContext(webAppCtx, true);
  }
486180
private void registerHandlers() {
        // general
        addHandler(new ReadyHandler(api));
        addHandler(new ResumedHandler(api));

        // server
        addHandler(new GuildBanAddHandler(api));
        addHandler(new GuildBanRemoveHandler(api));
        addHandler(new GuildCreateHandler(api));
        addHandler(new GuildDeleteHandler(api));
        addHandler(new GuildMembersChunkHandler(api));
        addHandler(new GuildMemberAddHandler(api));
        addHandler(new GuildMemberRemoveHandler(api));
        addHandler(new GuildMemberUpdateHandler(api));
        addHandler(new GuildUpdateHandler(api));
        addHandler(new VoiceStateUpdateHandler(api));

        // role
        addHandler(new GuildRoleCreateHandler(api));
        addHandler(new GuildRoleDeleteHandler(api));
        addHandler(new GuildRoleUpdateHandler(api));

        // emoji
        addHandler(new GuildEmojisUpdateHandler(api));

        // channel
        addHandler(new ChannelCreateHandler(api));
        addHandler(new ChannelDeleteHandler(api));
        addHandler(new ChannelPinsUpdateHandler(api));
        addHandler(new ChannelUpdateHandler(api));
        addHandler(new WebhooksUpdateHandler(api));

        // user
        addHandler(new PresencesReplaceHandler(api));
        addHandler(new PresenceUpdateHandler(api));
        addHandler(new TypingStartHandler(api));
        addHandler(new UserUpdateHandler(api));

        // message
        addHandler(new MessageCreateHandler(api));
        addHandler(new MessageDeleteBulkHandler(api));
        addHandler(new MessageDeleteHandler(api));
        addHandler(new MessageUpdateHandler(api));

        // reaction
        addHandler(new MessageReactionAddHandler(api));
        addHandler(new MessageReactionRemoveAllHandler(api));
        addHandler(new MessageReactionRemoveHandler(api));
    }
642231
function(options, key) {
        // a protected resource defaults to a 'user' role
        var options = options===true?{ path: key, roles: ['user'] }:options;
        var path = options.path;

        // only features that have defined 'path' AND 'roles'
        if (!options.roles || !path) {
            debug("missing %s roles for %s", key, path);
            return;
        }

        DEBUG && debug("protect: %s @ %s", key, path)
        router.use(path, function(req,res,next) {
            DEBUG && debug("PROTECTED: %s @ %s -> %j", path, req.path, options.roles);
            EnsureAuthenticated(req, res, false) && EnsureAuthorized(options, req, res, next)
        })
    }
420915
def add_handler(self, path, handler):
        
        self.signatures[path] = self.get_path_signature(path)
        self.handlers[path] = handler
508904
public static void put(@NotNull String path, @NotNull Handler handler) {
        staticInstance().put(prefixPath(path), handler);
    }
207478
public Handler addHandler(Handler handler) throws JettyBootstrapException {
        JettyHandler jettyHandler = new JettyHandler();
        jettyHandler.setHandler(handler);

        handlers.addHandler(handler);

        return handler;
    }
18309
@Deprecated
    public Blade put(@NonNull String path, @NonNull RouteHandler0 handler) {
        this.routeMatcher.addRoute(path, handler, HttpMethod.PUT);
        return this;
    }
328200
public Javalin addHandler(@NotNull HandlerType httpMethod, @NotNull String path, @NotNull Handler handler) {
        return addHandler(httpMethod, path, handler, new HashSet<>()); // no roles set for this route (open to everyone with default access manager)
    }