8.1.0 (Aug 21, 2019)

8.1.0 introduces some significant new features including:

- Configurable Annotations
- Default PojoSwaps
- Config Imports
- BasicRest, BasicRestGroup classes
- Path variables on resource paths
- Request Attributes API
- Role Guards
- Improved REST logging/debugging
- New MockRest API

##### juneau-marshall

- New utility class for diffing beans:
  - {@link oaj.utils.BeanDiff}
- New annotation for defining bean property names:
  - {@link oaj.annotation.Name}
- New serializer properties:
  - {@link oaj.serializer.WriterSerializer}
    - {@link oaj.serializer.WriterSerializer#WSERIALIZER_fileCharset WSERIALIZER_fileCharset}
    - {@link oaj.serializer.WriterSerializer#WSERIALIZER_streamCharset WSERIALIZER_streamCharset}
- The following POJO methods can be used to convert a POJO to/from a Map before serialization and after parsing.
  It's a convenient way of defining a POJO transform.
  - public Map toMap() - Can be any type of map with string keys and object vals.
  - public ObjectMap toMap()
  - public Map toMap(BeanSession bs) - Can be any type of map with string keys and object vals.
  - public ObjectMap toMap(BeanSession bs)
  - public static T fromMap(Map m) - Can be any type of map with string keys and object vals.
  - public static T fromMap(ObjectMap m)
  - public static T fromMap(BeanSession bs, Map m) - Can be any type of map with string keys and object vals.
  - public static T fromMap(BeanSession bs, ObjectMap m)
- New convenience debugging methods on Marshall API:
  - {@link oaj.marshall.Marshall}
    - {@link oaj.marshall.Marshall#format(String,Object...) format(String,Object...)} - MessageFormat-style formatter.
    - {@link oaj.marshall.Marshall#out(String,Object...) out(String,Object...)} - Prints MessageFormat-style messages to STDOUT.
    - {@link oaj.marshall.Marshall#err(String,Object...) err(String,Object...)} - Prints MessageFormat-style messages to STDERR.
- Serializer and parser APIs now throw IOExceptions in addition to SerializeException and ParseException to make it easier to determine if problems are stream based or syntax based.
- New Java 8 date-time transforms:
  - {@link oaj.transforms.TemporalSwap} - For all Java 8 temporal types (e.g. {@link java.time.ZonedDateTime})
  - {@link oaj.transforms.TemporalDateSwap} - For {@link java.util.Date}
  - {@link oaj.transforms.TemporalCalendarSwap} - For {@link java.util.Calendar}
- All serializers and parsers now have built-in default swaps for common class types:
  - {@link java.util.Enumeration}
  - {@link java.util.Iterator}
  - {@link java.util.Locale}
  - {@link java.util.Calendar} - ISO offset date-time.
  - {@link java.util.Date} - Local date-time
  - {@link java.time.Instant} - ISO instant.
  - {@link java.time.ZonedDateTime} - ISO offset date-time.
  - {@link java.time.LocalDate} - ISO local date.
  - {@link java.time.LocalDateTime} - ISO local date-time.
  - {@link java.time.LocalTime} - ISO local time.
  - {@link java.time.OffsetDateTime} - ISO offset date-time.
  - {@link java.time.OffsetTime} - ISO offset time.
  - {@link java.time.Year} - ISO year.
  - {@link java.time.YearMonth} - ISO year-month.
  - {@link java.time.Temporal} - ISO instant.
  - {@link java.util.TimeZone}
  - {@link javax.xml.datatype.XMLGregorianCalendar}
  - {@link java.time.ZoneId}

##### juneau-config

- Support for import statements:

  # Import values from another configuration: <ParentConfig1> [Foo] bar = baz

- The {@link oaj.config.store.ConfigFileStore} now automatically resolves file extensions.
  New configuration property for specifying search paths for file extensions:
  - {@link oaj.config.store.ConfigFileStore#FILESTORE_extensions}
- Fixed a bug where instances of {@link oaj.config.store.ConfigMemoryStore} ended up resolving to the same object.
- Uses "application.properties" file as a system default if present.
  Useful when being used in a Spring Boot application.
- New {@link oaj.config.Config#setSystemProperties} method for quickly moving configuration settings into the system properties.
- Entries in the system config are automatically set as system properties.
  This mean you can set any of the various serializer and parser settings (e.g. "JsonSerializer.simpleMode.b") in the default configuration area or application.properties.

##### juneau-rest-server

- New annotations that can be applied to REST classes and methods to configure serializers and parsers.

  // Old way using generic properties. @RestResource( path="/atom", title="Sample ATOM feed resource", properties={ @Property(name=WSERIALIZER_quoteChar, value="'"), @Property(name=RDF_rdfxml_tab, value="5"), @Property(nameRDF_addRootProperty, value="true"), @Property(name=BEAN_examples, value="{'org.apache.juneau.dto.atom.Feed': $F{AtomFeedResource_example.json}}") } ... ) public class AtomFeedResource extends BasicRestServletJena { ... }

  // New way using specific annotations. @RestResource( path="/atom", title="Sample ATOM feed resource" ... ) @SerializerConfig(quoteChar="'") @RdfConfig(rdfxml_tab="5", addRootProperty="true") @BeanConfig(examples="Feed: $F{AtomFeedResource_example.json}") public class AtomFeedResource extends BasicRestServletJena { ... }

  Config annotations are provided for all serializers and parsers:

  - {@link oaj.annotation.BeanConfig BeanConfig}
  - {@link oaj.csv.annotation.CsvConfig CsvConfig}
  - {@link oaj.html.annotation.HtmlConfig HtmlConfig}
  - {@link oaj.html.annotation.HtmlDocConfig HtmlDocConfig}
  - {@link oaj.jso.annotation.JsoConfig JsoConfig}
  - {@link oaj.json.annotation.JsonConfig JsonConfig}
  - {@link oaj.jsonschema.annotation.JsonSchemaConfig JsonSchemaConfig}
  - {@link oaj.msgpack.annotation.MsgPackConfig MsgPackConfig}
  - {@link oaj.oapi.annotation.OpenApiConfig OpenApiConfig}
  - {@link oaj.parser.annotation.ParserConfig ParserConfig}
  - {@link oaj.plaintext.annotation.PlainTextConfig PlainTextConfig}
  - {@link oaj.jena.annotation.RdfConfig RdfConfig}
  - {@link oaj.serializer.annotation.SerializerConfig SerializerConfig}
  - {@link oaj.soap.annotation.SoapXmlConfig SoapXmlConfig}
  - {@link oaj.uon.annotation.UonConfig UonConfig}
  - {@link oaj.urlencoding.annotation.UrlEncodingConfig UrlEncodingConfig}
  - {@link oaj.xml.annotation.XmlConfig XmlConfig}
- New support for using Servlet request attributes.
  - {@link oajr.RequestAttributes}
  - {@link oajr.RestContext}
    - {@link oajr.RestContext#REST_attrs REST_attrs}
  - {@link oajr.RestContextBuilder}
    - {@link oajr.RestContextBuilder#attrs(String...) attrs(String...)}
    - {@link oajr.RestContextBuilder#attr(String,Object) attr(String,Object)}
  - {@link oajr.RestMethodContext}
    - {@link oajr.RestMethodContext#RESTMETHOD_attrs RESTMETHOD_attrs}
  - {@link oajr.RestRequest}
    - {@link oajr.RestRequest#getAttributes() getAttributes()}
  - {@link oajr.RestResponse}
    - {@link oajr.RestResponse#getAttributes() getAttributes()}
    - {@link oajr.RestResponse#attr(String,Object) attr(String,Object)}
  - {@link oajr.annotation.Attr}
  - {@link oajr.annotation.RestMethod#attrs()}
  - RestResource.attrs()
  This deprecates the following APIs:
  - {@link oajr.RequestProperties}
  - {@link oajr.RestMethodProperties}
  - {@link oajr.RestRequest}
    - {@link oajr.RestRequest#getProperties() getProperties()}
    - {@link oajr.RestRequest#prop(String,Object) prop(String,Object)}
- Added the following classes that provide the same support as the servlet classes but doesn't extend from HttpServlet.
  This fixes an issue where instances of {@link oajr.BasicRestServlet} are registered as top-level servlets even though you don't want them to be.
  - {@link oajr.BasicRest} - Non-servlet equivalent to {@link oajr.BasicRestServlet}
  - {@link oajr.BasicRestGroup} - Non-servlet equivalent to {@link oajr.BasicRestServletGroup}
  - {@link oajr.BasicRestJena} - Non-servlet equivalent to {@link oajr.BasicRestServletJena}
  - {@link oajr.BasicRestJenaGroup} - Non-servlet equivalent to {@link oajr.BasicRestServletJenaGroup}
- HTML widgets now have access to the RestResponse object if they need access to the output bean.
- New annotations for simplified role-based guards on classes and methods:
  - RestResource
    - roleGuard()
    - rolesDeclared()
  - {@link oajr.annotation.RestMethod}
    - {@link oajr.annotation.RestMethod#roleGuard roleGuard()}
    - {@link oajr.annotation.RestMethod#rolesDeclared rolesDeclared()}
- New annotations for fine-tuned handling of http-methods/http-headers as query parameters and others:
  - RestResource
    - allowedHeaderParams()
    - allowedMethodHeaders()}
    - allowedMethodParams()
- The @RestResource(path) annotation can now use variables:

  @RestResource( path="/myResource/{foo}/{bar}" ) public class MyResource extends BasicRestServlet {...}

- New methods:
  - {@link oajr.RestRequest}
    - {@link oajr.RestRequest#getCharset() getCharset()}
  - {@link oajr.RestResponse}
    - {@link oajr.RestResponse#getCharset() getCharset()}
- New interface method for catching arbitrary thrown objects and converting them to other throwables.
  - {@link oajr.RestCallHandler}
    - {@link oajr.RestCallHandler#convertThrowable(Throwable) convertThrowable(Throwable)}
  - {@link oajr.BasicRestCallHandler}
    - {@link oajr.BasicRestCallHandler#convertThrowable(Throwable) convertThrowable(Throwable)}
- Support for fine-tuned logging of HTTP requests and responses.

  @RestResource( debug="per-request", logging=@Logging( level="info", rules={ @LoggingRule(codes"400-499", level="warning", req="short", res="short") @LoggingRule(codes"500-", level="severe", req="long", res="long") } ) ) public class MyRest { @RestMethod( method="POST", path="foo" logging=@Logging( level="info", rules={ @LoggingRule(exceptions"NotFound*", level="info") @LoggingRule(codes"200", disabled="true") } ) ) public String myMethod() throws Exception {...}

  See {@doc juneau-rest-server.LoggingAndDebugging} for details.
- Fixed a bug where the HTTP response was returning 405 (method not found) but should really be 404 (not found) when no path patterns match on any of the Java methods.

##### juneau-rest-client

- PATCH support added.