Test blog post #2

The @RestMethod.bpIncludes()/bpExcludes() annotations have been replaced simplified syntax.

Instead of LAX JSON, it's now an array of simple key/value pairs and the names have been shortened:

// Old:
@RestMethod(
   bpExcludes="{Bean1: 'foo,bar', '*': 'baz,qux'}"
)
// New:
@RestMethod(
   bpx={"Bean1: foo,bar", "*: baz,qux"}
)

See:
http://juneau.incubator.apache.org/site/apidocs/org/apache/juneau/rest/annotation/RestMethod.html#bpi--
http://juneau.incubator.apache.org/site/apidocs/org/apache/juneau/rest/annotation/RestMethod.html#bpx--

I've simplified the way the headers are defined on the HTML pages.

I've eliminated the @HtmlDoc.title()/description()/branding() annotations (and related methods and properties).  Instead, you just use the @HtmlDoc.header() with variables to define the header.

The default header value is defined in RestServletDefault as shown:

You can easily override this value to specify any value you wish.  This makes the header much more flexible and easier-to-understand.

The $R variable was changed to a DefaultingVar so that you can chain possible values to find a first-match (as shown above).

I've also added a new $F variable for pulling in values directly from localized files if you don't want to embed a bunch of HTML inside your annotations:

It's similar to widgets except it resolves to just arbitrary text (and doesn't support javascript and css like widgets do).
It's also similar to Class.getResourceAsStream(), but searches up the servlet class hierarchy for the file.  It can even pull the file from the JVM working directory as last resort.  
It also supports localized names based on the request Accept-Language.  So in the example above, if the request language is Japanese, we'll also search for DockerRegistryResourceAside_ja_JP.html and DockerRegistryResourceAside_ja.html.

Like widgets, it also strips comments from HTML files so you can add Apache license headers to your files.

Javadoc is here:  http://juneau.incubator.apache.org/site/apidocs/org/apache/juneau/rest/vars/FileVar.html

Just like widgets, the $F variable file contents can contain other variables.  (Heck...it can even contain other $F variables if you want to do fancy recursive nesting of files)

The full list of variables has been update here and linked to from various locations where they can be used:
http://juneau.incubator.apache.org/site/apidocs/org/apache/juneau/rest/RestContext.html#getVarResolver--

 

I've added an "INHERIT" literal string that can be used in the @HtmlDoc annotation to inherit and extend values from the servlet class.

Where this is useful is when you want to define a a set of links on a class, but want to add an additional link on a particular method.  Previously this meant you had to duplicate all the links on the method annotation such as shown below from the PetStore example:

Links defined on class:

Links overridden on method to add a single QUERY menu item:

With the "INHERIT" literal, you can include the parent links and augment them with more links like so:

The parent links are included in the position specified in the array, so you can include links before or after the list parent links, or you can optionally use square brackets to specify an index position if you want to insert your link in the middle of the parent links.  

The "INHERIT" literal can be used in any of the following @HtmlDoc values:  header, script, style, links, aside, footer.

When used on the @HtmlDoc in the @RestResource annotation, it inherits the value from the parent class.

 

I've made several overall improvements to the stylesheet support in the HTML views.

  1. I've simplified the CSS stylesheets.  It should be easier to create new stylesheets.

  2. The nav links are now a <OL> instead of a span of hardcoded links.  Makes it easier to customize the LAF of the nav section through CSS.

  3. New "light" stylesheet...

    For reference, this is the "devops" style...

    And this is the "original" style...


  4. I've added a menu-time to the examples that allow you to view the different styles...

 

FYI....I've made the following modifications to the following @HtmlDoc annotations:

  • links() - Now an array of strings instead of a JSON object. Simplified syntax. 
    For example:

    Previous syntax will still work, but you're encouraged to use the simplified syntax.
  • Several annotations are now arrays of strings instead of simple strings. Values are simply concatenated with newlines which makes multi-line values cleaner.