| Modifiers | Name | Description |
|---|---|---|
static class |
GrailsBanner.DefaultVersionFormatter |
The default implementation of the VersionsFormatter. |
static enum |
GrailsBanner.DefaultVersionOption |
Enumeration of default version options. |
static enum |
GrailsBanner.OptionalVersionOption |
Enumeration of optional version options. |
static enum |
GrailsBanner.VersionOption |
Enumeration of supported version options. |
static interface |
GrailsBanner.VersionsFormatter |
Strategy interface for formatting version information into printable lines. |
| Type | Name and description |
|---|---|
int |
artPaddingBottom |
java.lang.String |
bannerFile |
int |
bannerPaddingBottom |
int |
bannerPaddingTop |
| Constructor and description |
|---|
GrailsBanner() |
| Type Params | Return Type | Name and description |
|---|---|---|
|
protected java.lang.String |
colour(java.lang.String art, Environment environment)The art in the configured colour, or as it stands where none is wanted. |
|
protected java.lang.String |
createBannerArt(Environment environment)Creates the banner art to be displayed. |
|
protected java.util.Map<java.lang.String, java.lang.String> |
createBannerVersions(Environment env)Creates a map of versions to be displayed in the banner. |
|
protected GrailsBanner.VersionsFormatter |
createVersionsFormatter()Creates the versions formatter to format the version information. |
|
protected java.util.Map<java.lang.String, java.lang.String> |
findContainerVersion()The servlet container the application is running on, and the version it records. |
|
protected java.lang.String |
findJettyVersion() |
|
protected java.lang.String |
findTomcatVersion()Tomcat's version, read from the resource it ships rather than only from its manifest. |
|
protected java.lang.String |
findUndertowVersion() |
|
protected static java.lang.String |
findVersion(java.lang.String className)The version a library records in the manifest of the jar it ships in. |
|
protected static java.lang.String |
findVersionInResource(java.lang.String resource, java.lang.String key)A version a library records in a resource it ships, read without loading any of its classes. |
|
protected boolean |
isNativeImage()Whether this is running as an image. |
|
void |
printBanner(Environment environment, java.lang.Class<?> sourceClass, java.io.PrintStream out)Prints the banner to the specified PrintStream. |
|
protected void |
printMark(Environment environment, java.io.PrintStream out, int bannerWidth)Marks how the application was started, centred under the art and above the versions. |
|
protected boolean |
readsAotCache()Whether the JDK was given a cache to read. |
|
protected AnsiElement |
resolveArtColour(Environment environment)The colour to show the art in, read from grails.banner.art.color. |
|
protected java.lang.String |
resolveMark(Environment environment)What to say, strongest first, or nothing where an application started the ordinary way. |
|
protected AnsiElement |
resolveMarkColour(Environment environment)The colour to show the mark in, read from grails.banner.mark.color. |
|
protected boolean |
shouldDisplayArt(Environment env)Determines whether to display the banner art. |
|
protected boolean |
shouldDisplayVersions(Environment env)Determines whether to display the version information. |
|
protected java.util.List<java.lang.String> |
unrecognisedVersionOptions(Environment env)The configured version options that name none of VersionOption, in the order they were written. |
|
protected java.util.Map<java.lang.String, java.lang.String> |
versionsFor(java.lang.String key, Environment env)What one version option contributes, as the labels it is shown under and what each records. |
|
protected void |
warnAboutUnrecognisedVersions(Environment env)Says which of the version options an application configured were not recognised. |
| Methods inherited from class | Name |
|---|---|
class java.lang.Object |
java.lang.Object#equals(java.lang.Object), java.lang.Object#getClass(), java.lang.Object#hashCode(), java.lang.Object#notify(), java.lang.Object#notifyAll(), java.lang.Object#toString(), java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int) |
The art in the configured colour, or as it stands where none is wanted.
AnsiOutput writes the escapes only where colour has been enabled, so this is the same string on a terminal that cannot colour, in a redirected log, and wherever an application has turned colour off.
Creates the banner art to be displayed.
environment - the current environmentCreates a map of versions to be displayed in the banner.
env - the current envCreates the versions formatter to format the version information.
The servlet container the application is running on, and the version it records.
An application runs on one container: choosing another is done by excluding the starter for this one, so two are not on the classpath together. They are therefore tried in the order they are commonly used and the first one found is the answer -- an application on Tomcat never goes looking for Jetty.
On a container that records no version, or on none of these, this is empty and the banner leaves the line out rather than saying it does not know.
Tomcat's version, read from the resource it ships rather than only from its manifest.
A resource survives being repackaged into an executable jar or built into an image, where the manifest's attributes are no longer attached to the package -- which is why the manifest route reads as nothing in exactly the two places a version is most worth having.
The version a library records in the manifest of the jar it ships in.
Loaded without being initialised. A version is read about a library rather than from it, and running a static initialiser to find one lets the library do whatever it does on the way -- Spring Security logs a line of its own from there, which arrived in the middle of the banner, between the mark and the very versions it was being read for. The manifest is attached to the package when the class is loaded, and loading is all this needs.
className - the fully qualified name of a class the library shipsnull where the class is absent or records noneA version a library records in a resource it ships, read without loading any of its classes.
The manifest route only works while a jar is a plain entry on the classpath. Repackaged into an executable jar its attributes are no longer attached to the package, and an image has no jars at all -- which is why a container version read that way reads as nothing in exactly the two places it is most worth having. A resource is still a resource in both.
resource - the classpath location of the resource to readkey - the property within it that carries the versionnull where the resource or the property is absentWhether this is running as an image. A seam, so the mark can be covered without being one.
Prints the banner to the specified PrintStream.
environment - the current environmentsourceClass - the source classout - the PrintStream to print toMarks how the application was started, centred under the art and above the versions.
Only where it is worth saying: an image, a JVM given a cache to read, or one running bean definitions that were generated. An ordinary start says nothing.
Written plainly, and deliberately: a banner is printed on the thread that is starting the application, which cannot get on until this returns. Anything drawn over time here is time the application is not starting, and an image that starts in two thirds of a second should not spend a third of it on its own announcement.
Whether the JDK was given a cache to read.
Asked of the arguments the JVM was started with rather than of the cache: a JVM handed one it cannot use declines it and starts as it would have anyway, and this is the banner rather than a diagnostic.
The colour to show the art in, read from grails.banner.art.color.
Takes a number for one of the 256 colours a terminal offers, a name for one of the eight
it has always had (red, bright_blue), or none to leave the art as it
stands. A value that is neither falls back to the default rather than failing to start over
the colour of a banner.
What to say, strongest first, or nothing where an application started the ordinary way.
An image has already done all of it. A cache means the JDK was handed what a previous run worked out. Generated bean definitions are the smaller half of the same idea, and worth saying on their own because an application can be run either with them or without.
The colour to show the mark in, read from grails.banner.mark.color.
Its own colour rather than the art's, and brighter, so that what an application was started
as is not read as the last line of the drawing above it. Takes the same values as
grails.banner.art.color.
Determines whether to display the banner art.
env - the current environmentDetermines whether to display the version information.
env - the current environmentThe configured version options that name none of VersionOption, in the order they were written.
Which list an option belongs to is not asked. An option is named by an application to say that it wants it or does not, and moving one between the shown-by-default set and the asked-for set is a decision of this class -- so an application that asked for a version that has since become one of the defaults said something recognisable, and is told nothing.
What one version option contributes, as the labels it is shown under and what each records.
A value of null is a library that is absent or records nothing; the caller decides
whether that is left out or shown as unknown. An option that contributes nothing at all --
the container, where none of them is there -- contributes no label to decide about.
Says which of the version options an application configured were not recognised.
An option that names nothing is dropped, and was dropped without a word -- so a name with a typo in it reads as a banner that quietly ignores what it was told, and the only way to find out is to notice a line that is not there.
Said after the banner rather than while one is being built. A line logged partway through arrives between the mark and the versions, which is the very thing reading a version without initialising the library it belongs to was for.