private WebSocketScope getScope ( WebSocketConnection conn ) { if ( log . isTraceEnabled ( ) ) { log . trace ( "Scopes: {}" , scopes ) ; } log . debug ( "getScope: {}" , conn ) ; WebSocketScope wsScope ; String path = conn . getPath ( ) ; if ( ! scopes . containsKey ( path ) ) { // check for default scope if ( ! scopes . containsKey ( "default" ) ) { wsScope = new WebSocketScope ( ) ; wsScope . setPath ( path ) ; notifyListeners ( WebSocketEvent . SCOPE_CREATED , wsScope ) ; addWebSocketScope ( wsScope ) ; //log.debug("Use the IWebSocketScopeListener interface to be notified of new scopes"); } else { path = "default" ; } } wsScope = scopes . get ( path ) ; log . debug ( "Returning: {}" , wsScope ) ; return wsScope ; }
Get the corresponding scope if none exists make new one .