Adds a specific WebSocket handler for the given path to the instance.
774842
private Javalin addWsHandler(@NotNull WsHandlerType handlerType, @NotNull String path, @NotNull Consumer<WsHandler> wsHandler) {
        return addWsHandler(handlerType, path, wsHandler, new HashSet<>());
    }
1022038
public Javalin wsBefore(@NotNull String path, @NotNull Consumer<WsHandler> wsHandler) {
        return addWsHandler(WsHandlerType.WS_BEFORE, path, wsHandler);
    }
339372
public Blade get(@NonNull String path, @NonNull RouteHandler handler) {
        this.routeMatcher.addRoute(path, handler, HttpMethod.GET);
        return this;
    }
1271706
function addPathToExpress(handlerObj, handlePath) {
  var self = handlerObj;
  //Check to make sure that the module exists and will load properly to what node expects
  if (moduleExists.call(self, handlePath)) {
    //retrieve the http verbs defined in the handler files and then add to the swagger server
    var handleVerbs = require(handlePath);

    //Get the route path by removing the ./handlers and the .js file extension
    //TODO: Use path names to get these
    var routePath = handlePath.replace(/.*\/handlers/, '');
    routePath = routePath.replace(/\.js/, '');

    swaggerMethods.forEach(function(method) {
      if (handleVerbs[method] && validSwaggerize(self, handleVerbs[method])) {
        self.server[method](routePath, handleVerbs[method]);
      }
    });
  }
}
996369
async def dispatch_websocket(
        self, websocket_context: Optional[WebsocketContext]=None,
    ) -> None:
        
        websocket_ = (websocket_context or _websocket_ctx_stack.top).websocket
        if websocket_.routing_exception is not None:
            raise websocket_.routing_exception

        handler = self.view_functions[websocket_.url_rule.endpoint]
        return await handler(**websocket_.view_args)
1358833
public Javalin patch(@NotNull String path, @NotNull Handler handler) {
        return addHandler(HandlerType.PATCH, path, handler);
    }
1178414
public Blade before(@NonNull String path, @NonNull RouteHandler handler) {
        this.routeMatcher.addRoute(path, handler, HttpMethod.BEFORE);
        return this;
    }
700854
public static void before(@NotNull String path, @NotNull Handler handler) {
        staticInstance().before(prefixPath(path), handler);
    }
1172919
def add_router(self, path, router):
        
        self.add(HTTPMethod.ALL, path, router)
        return self
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);
        }
    }
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);
  }
1077100
public Router<T> addConnect(String path, T target) {
		return addRoute(HttpMethod.CONNECT, path, target);
	}
1140403
function(path, handler) {
    var node = trie.define(path)[0];

    if (typeof handler !== 'function') {
      throw new Error('invalid handler');
    }

    node.handler = handler;
  }
54551
public Javalin post(@NotNull String path, @NotNull Handler handler, @NotNull Set<Role> permittedRoles) {
        return addHandler(HandlerType.POST, path, handler, permittedRoles);
    }
1278473
public Javalin ws(@NotNull String path, @NotNull Consumer<WsHandler> ws) {
        return ws(path, ws, new HashSet<>());
    }
774185
def _websocket_handler(self, ws):
        """"""
        # try to set a socket timeout matching the configured ping interval
        for attr in ['_sock', 'socket']:  # pragma: no cover
            if hasattr(ws, attr) and hasattr(getattr(ws, attr), 'settimeout'):
                getattr(ws, attr).settimeout(self.server.ping_timeout)

        if self.connected:
            # the socket was already connected, so this is an upgrade
            self.upgrading = True  # hold packet sends during the upgrade

            pkt = ws.wait()
            decoded_pkt = packet.Packet(encoded_packet=pkt)
            if decoded_pkt.packet_type != packet.PING or \
                    decoded_pkt.data != 'probe':
                self.server.logger.info(
                    '%s: Failed websocket upgrade, no PING packet', self.sid)
                return []
            ws.send(packet.Packet(
                packet.PONG,
                data=six.text_type('probe')).encode(always_bytes=False))
            self.queue.put(packet.Packet(packet.NOOP))  # end poll

            pkt = ws.wait()
            decoded_pkt = packet.Packet(encoded_packet=pkt)
            if decoded_pkt.packet_type != packet.UPGRADE:
                self.upgraded = False
                self.server.logger.info(
                    ('%s: Failed websocket upgrade, expected UPGRADE packet, '
                     'received %s instead.'),
                    self.sid, pkt)
                return []
            self.upgraded = True

            # flush any packets that were sent during the upgrade
            for pkt in self.packet_backlog:
                self.queue.put(pkt)
            self.packet_backlog = []
            self.upgrading = False
        else:
            self.connected = True
            self.upgraded = True

        # start separate writer thread
        def writer():
            while True:
                packets = None
                try:
                    packets = self.poll()
                except exceptions.QueueEmpty:
                    break
                if not packets:
                    # empty packet list returned -> connection closed
                    break
                try:
                    for pkt in packets:
                        ws.send(pkt.encode(always_bytes=False))
                except:
                    break
        writer_task = self.server.start_background_task(writer)

        self.server.logger.info(
            '%s: Upgrade to websocket successful', self.sid)

        while True:
            p = None
            try:
                p = ws.wait()
            except Exception as e:
                # if the socket is already closed, we can assume this is a
                # downstream error of that
                if not self.closed:  # pragma: no cover
                    self.server.logger.info(
                        '%s: Unexpected error "%s", closing connection',
                        self.sid, str(e))
                break
            if p is None:
                # connection closed by client
                break
            if isinstance(p, six.text_type):  # pragma: no cover
                p = p.encode('utf-8')
            pkt = packet.Packet(encoded_packet=p)
            try:
                self.receive(pkt)
            except exceptions.UnknownPacketError:  # pragma: no cover
                pass
            except exceptions.SocketIsClosedError:  # pragma: no cover
                self.server.logger.info('Receive error -- socket is closed')
                break
            except:  # pragma: no cover
                # if we get an unexpected exception we log the error and exit
                # the connection properly
                self.server.logger.exception('Unknown receive error')
                break

        self.queue.put(None)  # unlock the writer task so that it can exit
        writer_task.join()
        self.close(wait=False, abort=True)

        return []
675816
public ThreadContextClassLoaderBuilder addPath(final String path) {

        // Check sanity
        Validate.notEmpty(path, "path");

        // Convert to an URL, and delegate.
        final URL anUrl;
        try {
            anUrl = new File(path).toURI().toURL();
        } catch (MalformedURLException e) {
            throw new IllegalArgumentException("Could not convert path [" + path + "] to an URL.", e);
        }

        // Delegate
        return addURL(anUrl);
    }