public JcsegServer registerHandler ( ) { String basePath = this . getClass ( ) . getPackage ( ) . getName ( ) + ".controller" ; AbstractRouter router = new DynamicRestRouter ( basePath , MainController . class ) ; router . addMapping ( "/extractor/keywords" , KeywordsController . class ) ; router . addMapping ( "/extractor/keyphrase" , KeyphraseController . class ) ; router . addMapping ( "/extractor/sentence" , SentenceController . class ) ; router . addMapping ( "/extractor/summary" , SummaryController . class ) ; router . addMapping ( "/tokenizer/default" , TokenizerController . class ) ; /* * the rest of path and dynamic rest checking will handler it */ //router.addMapping("/tokenizer/default", TokenizerController.class); /* * prepare standard handler */ StandardHandler stdHandler = new StandardHandler ( config , resourcePool , router ) ; /* * prepare the resource handler */ JcsegResourceHandler resourceHandler = new JcsegResourceHandler ( ) ; /* * i am going to rewrite the path to handler mapping mechanism * check the Router handler for more info */ GzipHandler gzipHandler = new GzipHandler ( ) ; HandlerList handlers = new HandlerList ( ) ; handlers . setHandlers ( new Handler [ ] { stdHandler , resourceHandler } ) ; gzipHandler . setHandler ( handlers ) ; server . setHandler ( gzipHandler ) ; return this ; }
register handler service