@ GetMapping public String init ( Model model ) { final UriComponents uriComponents = ServletUriComponentsBuilder . fromCurrentContextPath ( ) . build ( ) ; model . addAttribute ( "molgenisUrl" , uriComponents . toUriString ( ) + URI + "/swagger.yml" ) ; model . addAttribute ( "baseUrl" , uriComponents . toUriString ( ) ) ; final String currentUsername = SecurityUtils . getCurrentUsername ( ) ; if ( currentUsername != null ) { model . addAttribute ( "token" , tokenService . generateAndStoreToken ( currentUsername , "For Swagger UI" ) ) ; } return "view-swagger-ui" ; }
Serves the Swagger UI which allows you to try out the documented endpoints . Sets the url parameter to the swagger yaml that describes the REST API . Creates an apiKey token for the current user .