public void init() {
   try {
     this.cfg = AppConfig.getInstance();
     loadTemplateContent();
     this.audioFiles = this.getAudioFileNames();
   } catch (IOException e) {
     // print stack trace instead of handling
     e.printStackTrace();
   }
 }
  private OAuthToken getToken() throws RESTException {
    try {
      final AppConfig cfg = AppConfig.getInstance();
      final String path = "WEB-INF/token.properties";
      final String tokenFile = getServletContext().getRealPath(path);

      OAuthToken token = OAuthToken.loadToken(tokenFile);
      if (token == null || token.isAccessTokenExpired()) {
        final String endpoint = cfg.getFQDN() + OAuthService.API_URL;
        final String clientId = cfg.getClientId();
        final String clientSecret = cfg.getClientSecret();
        final OAuthService service =
            new OAuthService(getRESTConfig(endpoint), clientId, clientSecret);

        token = service.getToken(cfg.getProperty("scope"));
        token.saveToken(tokenFile);
      }
      return token;
    } catch (IOException ioe) {
      throw new RESTException(ioe);
    }
  }