Skip to main content

Stylesheets

Every page served by a BasicRestServlet is styled by one stylesheet. These shots are the petstore's bean-description page (/console/about/beans) in each of the three stock stylesheets. The default "devops" look-and-feel:

A BasicRestServlet page in the devops stylesheet

The "light" look-and-feel:

The same page in the light stylesheet

And the "dark" look-and-feel:

The same page in the dark stylesheet

The stylesheet URL is controlled by the @HtmlDocConfig(stylesheet) annotation.

The BasicUniversalConfig interface defines the stylesheet served up as a static file:

@HtmlDocConfig(
stylesheet="$C{REST/theme,servlet:/htdocs/themes/devops.css}"
)
public interface BasicUniversalConfig {...}

The $C{REST/theme,servlet:/htdocs/themes/devops.css} variable says to use the URI defined in your servlet's config file, if there is one, and to default to serving up the file htdocs/themes/devops.css which is in the resource folder of the juneau-rest-server module.

To provide your own stylesheet, simply override the stylesheet attribute and point to a different file:

@HtmlDocConfig(
stylesheet="servlet:/htdocs/themes/my-style.css"
)
public class MyResourceBaseClass extends BasicRestServlet {...}

Or set REST/theme in the servlet's config file to point every page of the servlet at another stylesheet without touching the code.