The look-and-feel of an application is now controlled through the external configuration file and access to
CSS stylesheets in the working directory in a new folder called files:
The default configuration is this:
#=======================================================================================================================
# REST settings
#=======================================================================================================================
[REST]
staticFiles = htdocs:files/htdocs
# Stylesheet to use for HTML views.
theme = servlet:/htdocs/themes/devops.css
headerIcon = servlet:/htdocs/images/juneau.png
headerLink = http://juneau.apache.org
footerIcon = servlet:/htdocs/images/asf.png
footerLink = http://www.apache.org
icon = $C{REST/headerIcon}
header = <a href='$U{$C{REST/headerLink}}'><img src='$U{$C{REST/headerIcon}}' style='position:absolute;top:5;right:5;background-color:transparent;height:30px'/></a>
footer = <a href='$U{$C{REST/footerLink}}'><img style='float:right;padding-right:20px;height:32px' src='$U{$C{REST/footerIcon}}'>
Note that static files can now be served up from the files directory in the working directory,
and you have access to modify the CSS theme files.
The SwaggerUI.css file controls the look-and-feel of the Swagger UI, so you can make
modification there as well.
The BasicRestConfig interface (which defines the default settings for the BasicRestServlet class)
now looks like this...
@RestResource(
...
htmldoc=@HtmlDoc(
header={
"<h1>$R{resourceTitle}</h1>",
"<h2>$R{methodSummary,resourceDescription}</h2>",
"$C{REST/header}"
},
navlinks={
"up: request:/.."
},
stylesheet="$C{REST/theme,servlet:/htdocs/themes/devops.css}",
head={
"<link rel='icon' href='$U{$C{REST/icon}}'/>"
},
footer="$C{REST/footer}"
),
// These are static files that are served up by the servlet under the specified sub-paths.
// For example, "/servletPath/htdocs/javadoc.css" resolves to the file "[servlet-package]/htdocs/javadoc.css"
staticFiles={"$C{REST/staticFiles}"}
)
public interface BasicRestConfig {}
The PoweredByApache widget which used to serve as a page footer has been eliminated.
If you're testing out changes in the theme stylesheets, you may want to set the following system property
that prevents caching of those files so that you don't need to restart the microservice each time a change is made:
#=======================================================================================================================
# System properties
#=======================================================================================================================
[SystemProperties]
# Disable classpath resource caching.
# Useful if you're attached using a debugger and you're modifying classpath resources while running.
RestContext.useClasspathResourceCaching.b = false