private String parseHtmlTemplate(UriInfo uriInfo, HttpServletRequest request){ String html = getHTMLTemplate(); html = html.replaceAll(VAR_CONTEXT_ROOT, getContextRoot(uriInfo,request)); html = html.replaceAll(VAR_CURRENT_YEAR, getCopyrightYear()); // Dynamic whitelabel properties. try { Iterable<String> propertyNames = config.getPropertyNames(); for(String key: propertyNames){ if(key.startsWith(KEY_IDENTIFIER) && !isKnownProperty(key)){ String htmlKey = PERSENTAGE + key + PERSENTAGE; html = html.replaceAll(htmlKey, config.getValue(key,String.class)); } } }catch(UnsupportedOperationException uoe){ log.log(Level.WARNING, "Can not replace dynamic properties in the Open API Swagger template. {0}", uoe.getMessage()); } // Then properties with defaults. html = html.replaceAll(VAR_COPYRIGHT_BY, copyrightBy); html = html.replaceAll(VAR_TITLE, title); html = html.replaceAll(VAR_SWAGGER_THEME, swaggerUiTheme); html = html.replaceAll(VAR_SERVER_INFO, getServerInfo(request)); return html; }
private String parseHtmlTemplate(UriInfo uriInfo, HttpServletRequest request){ String html = getHTMLTemplate(); html = html.replaceAll(VAR_CONTEXT_ROOT, getContextRoot(uriInfo,request)); html = html.replaceAll(VAR_CURRENT_YEAR, getCopyrightYear()); // Dynamic whitelabel properties. try { Iterable<String> propertyNames = config.getPropertyNames(); for(String key: propertyNames){ if(key.startsWith(KEY_IDENTIFIER) && !isKnownProperty(key)){ String htmlKey = PERSENTAGE + key + PERSENTAGE; html = html.replaceAll(htmlKey, config.getValue(key,String.class)); } } }catch(UnsupportedOperationException uoe){ log.log(Level.WARNING, "Can not replace dynamic properties in the Open API Swagger template. {0}", uoe.getMessage()); } // Then properties with defaults. html = html.replaceAll(VAR_COPYRIGHT_BY, copyrightBy); html = html.replaceAll(VAR_TITLE, title); html = html.replaceAll(VAR_SWAGGER_THEME, swaggerUiTheme); html = html.replaceAll(VAR_SERVER_INFO, getServerInfo(request)); return html; }