public synchronized Object put ( Object pathSpec , Object object ) { StringTokenizer tok = new StringTokenizer ( pathSpec . toString ( ) , __pathSpecSeparators ) ; Object old = null ; while ( tok . hasMoreTokens ( ) ) { String spec = tok . nextToken ( ) ; if ( ! spec . startsWith ( "/" ) && ! spec . startsWith ( "*." ) ) { log . warn ( "PathSpec " + spec + ". must start with '/' or '*.'" ) ; spec = "/" + spec ; } old = super . put ( spec , object ) ; // Make entry that was just created. Entry entry = new Entry ( spec , object ) ; if ( entry . getKey ( ) . equals ( spec ) ) { if ( spec . equals ( "/*" ) ) _prefixDefault = entry ; else if ( spec . endsWith ( "/*" ) ) { _prefixMap . put ( spec . substring ( 0 , spec . length ( ) - 2 ) , entry ) ; _exactMap . put ( spec . substring ( 0 , spec . length ( ) - 1 ) , entry ) ; _exactMap . put ( spec . substring ( 0 , spec . length ( ) - 2 ) , entry ) ; } else if ( spec . startsWith ( "*." ) ) _suffixMap . put ( spec . substring ( 2 ) , entry ) ; else if ( spec . equals ( "/" ) ) { if ( _nodefault ) _exactMap . put ( spec , entry ) ; else { _default = entry ; _defaultSingletonList = SingletonList . newSingletonList ( _default ) ; } } else _exactMap . put ( spec , entry ) ; } } return old ; }
Add a single path match to the PathMap .