package Ġpub . ed hol m . irc 2 rss . controllers Ċ Ċ import Ġcom . rome tools . rome . io . Syn d Feed Output Ċ import Ġorg . springframework . http . MediaType Ċ import Ġorg . springframework . web . bind . annotation . GetMapping Ċ import Ġorg . springframework . web . bind . annotation . RequestMapping Ċ import Ġorg . springframework . web . bind . annotation . RequestParam Ċ import Ġorg . springframework . web . bind . annotation . RestController Ċ import Ġpub . ed hol m . irc 2 rss . domain . Category Ċ import Ġpub . ed hol m . irc 2 rss . rss . Feed Factory Ċ Ċ @ RestController Ċ @ RequestMapping ("/ rss ") Ċ class ĠR ss Controller ( private Ġval Ġfeed Factory : ĠFeed Factory ) Ġ{ ĊĠ Ġ@ GetMapping ( value Ġ= Ġ["/ torrent le ech "], Ġproduces Ġ= Ġ[( MediaType . APPLICATION _ RSS _ XML _ VALUE )]) ĊĠ Ġfun Ġtorrent le ech (@ RequestParam Ġcategories : ĠString ?, Ġ@ RequestParam ( defaultValue Ġ= Ġ" 1 5 ", Ġrequired Ġ= Ġfalse ) Ġsize : ĠInt Ġ= Ġ 1 5 ): ĠString Ġ{ ĊĠĠĠ Ġreturn Ġif Ġ( categories Ġ== Ġnull ) Ġ{ ĊĠĠĠĠĠ ĠSyn d Feed Output (). output String ( feed Factory . tl Feed ( size Ġ= Ġsize )) ĊĠĠĠ Ġ} Ġelse Ġ{ ĊĠĠĠĠĠ ĠSyn d Feed Output (). output String ( feed Factory . tl Feed ( convert Comma Categories ( categories ), Ġsize Ġ= Ġsize )) ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġconvert Comma Categories ( comma Separ ated Categories : ĠString ): ĠCollection < Category > Ġ{ ĊĠĠĠ Ġreturn Ġcomma Separ ated Categories ĊĠĠĠĠĠ Ġ. split (",") ĊĠĠĠĠĠ Ġ. map Ġ{ ĠCategory . valueOf ( it ) Ġ} ĊĠ Ġ} Ċ }