package Ġorg . http 4 k . routing Ċ Ċ import Ġorg . http 4 k . core . ContentType Ċ import Ġorg . http 4 k . core . Filter Ċ import Ġorg . http 4 k . core . Http Handler Ċ import Ġorg . http 4 k . core . Method Ċ import Ġorg . http 4 k . core . Request Ċ import Ġorg . http 4 k . core . Response Ċ import Ġorg . http 4 k . core . Status Ċ import Ġorg . http 4 k . core . Uri Template Ċ Ċ interface ĠRouter Ġ{ ĊĠĠĠ Ġfun Ġmatch ( request : ĠRequest ): ĠHttp Handler ? Ċ } Ċ Ċ interface ĠRouting Http Handler Ġ: ĠRouter , ĠHttp Handler Ġ{ ĊĠĠĠ Ġfun Ġwith Filter ( new : ĠFilter ): ĠRouting Http Handler ĊĠĠĠ Ġfun Ġwith BasePath ( new : ĠString ): ĠRouting Http Handler Ċ } Ċ Ċ fun Ġroutes ( var arg Ġlist : ĠPair < Method , ĠHttp Handler >): ĠRouting Http Handler Ġ= Ġroutes (* list . map Ġ{ Ġ"" Ġbind Ġit . first Ġto Ġit . second Ġ}. to Typed Array ()) Ċ Ċ fun Ġroutes ( var arg Ġlist : ĠRouting Http Handler ): ĠRouting Http Handler Ġ= Ġobject Ġ: ĠRouting Http Handler Ġ{ ĊĠĠĠ Ġoverride Ġfun Ġinvoke ( p 1 : ĠRequest ): ĠResponse Ġ= Ġmatch ( p 1 )?. invoke ( p 1 ) Ġ?: ĠResponse ( Status . NOT _ FOUND . description (" Route Ġnot Ġfound ")) ĊĊĠĠĠ Ġoverride Ġfun Ġmatch ( request : ĠRequest ): ĠHttp Handler ? Ġ= Ġlist . find Ġ{ Ġit . match ( request ) Ġ!= Ġnull Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġwith Filter ( new : ĠFilter ): ĠRouting Http Handler Ġ= Ġroutes (* list . map Ġ{ Ġit . with Filter ( new ) Ġ}. to Typed Array ()) ĊĊĠĠĠ Ġoverride Ġfun Ġwith BasePath ( new : ĠString ): ĠRouting Http Handler Ġ= Ġroutes (* list . map Ġ{ Ġit . with BasePath ( new ) Ġ}. to Typed Array ()) Ċ } Ċ Ċ fun Ġstatic ( resource Loader : ĠResource Loader Ġ= ĠResource Loader . Classpath (), Ġvar arg Ġextra Pairs : ĠPair < String , ĠContentType >): ĠRouting Http Handler Ġ= ĊĠĠĠ ĠStatic Routing Http Handler ("", Ġresource Loader , Ġextra Pairs . asList (). toMap ()) Ċ Ċ fun ĠRequest . path ( name : ĠString ): ĠString ? Ġ= Ġuri Template (). extract ( uri . path )[ name ] Ċ Ċ class ĠPath Method ( val Ġpath : ĠString , Ġval Ġmethod : ĠMethod ) Ġ{ ĊĠĠĠ Ġin fix Ġfun Ġto ( action : ĠHttp Handler ): ĠRouting Http Handler Ġ= ĠTemplate Routing Http Handler ( method , ĠUri Template . from ( path ), Ġaction ) Ċ } Ċ Ċ infix Ġfun ĠString . bind ( method : ĠMethod ): ĠPath Method Ġ= ĠPath Method ( this , Ġmethod ) Ċ Ċ @ Deprecated (" For Ġconsistency Ġwith Ġrouting ĠAPI ", ĠReplace With (" this . first Ġbind Ġthis . second Ġto Ġaction ")) Ċ infix Ġfun ĠPair < String , ĠMethod >. bind ( action : ĠHttp Handler ): ĠRouting Http Handler Ġ= ĠTemplate Routing Http Handler ( second , ĠUri Template . from ( first ), Ġaction ) Ċ Ċ infix Ġfun ĠString . bind ( router : ĠRouting Http Handler ): ĠRouting Http Handler Ġ= Ġrouter . with BasePath ( this ) Ċ Ċ infix Ġfun ĠString . bind ( action : ĠHttp Handler ): ĠRouting Http Handler Ġ= ĠTemplate Routing Http Handler ( null , ĠUri Template . from ( this ), Ġaction ) Ċ