6.2.0 (Apr 28, 2017)

Juneau 6.2.0 is a major update.

##### org.apache.juneau

- Revamped the serializer, parser classes to use builders for creation. Serializers and parsers are now unmodifiable objects once they are created. This is a breaking code change that will require adoption.

  /* Creating a new serializer or parser */ // Old way WriterSerializer s = new JsonSerializer().setUseWhitespace(true).pojoSwaps(BSwap.class).lock(); // New way WriterSerializer s = JsonSerializer.create().ws().pojoSwaps(BSwap.class).build(); /* Cloning an existing serializer or parser */ // Old way WriterSerializer s = SimpleJsonSerializer.DEFAULT .clone().setUseWhitespace(true).pojoSwaps(BSwap.class).lock(); // New way WriterSerializer s = SimpleJsonSerializer.DEFAULT .builder().ws().pojoSwaps(BSwap.class).build();

- Also introduced the following builder classes and related architecture changes to make the built objects unmodifiable:
  - {@del oaj.serializer.SerializerGroup.Builder}
  - {@del oaj.parser.ParserGroup.Builder}
  - {@del oaj.encoders.EncoderGroup.Builder}
- Revamped the config file API to use a build: {@del ConfigFileBuilder}.
- Removed the {@del Lockable} interface.
- New addBeanTypeProperties setting added to serializers to override the {@del SerializerContext#SERIALIZER_addBeanTypeProperties} setting for individual serializers in a serializer group:
  - {@del HtmlSerializerContext#HTML_addBeanTypeProperties}
  - {@del JsonSerializerContext#JSON_addBeanTypeProperties}
  - {@del MsgPackSerializerContext#MSGPACK_addBeanTypeProperties}
  - {@del UonSerializerContext#UON_addBeanTypeProperties}
  - {@del XmlSerializerContext#XML_addBeanTypeProperties}
  - {@del RdfSerializerContext#RDF_addBeanTypeProperties}
- UON notation serializers and parsers moved into the new org.apache.juneau.uon package.
- New {@link oaj.xml.annotation.XmlFormat#VOID} format to identify HTML void elements.
- Tweaks to HTML5 support.
  - Fixed handling of empty non-void elements in HTML serializer.
  - Added style() override methods to all elements.
- Improvements to Swagger support.
  - New {@link oaj.dto.swagger.SwaggerBuilder} class.
  - Fluent-style setters added to the Swagger beans.
  - Added Swagger examples {@del here} and in the {@del org.apache.juneau.dto.swagger} javadocs.
- Improvements to {@link oaj.svl.VarResolver}.
  - New {@link oaj.svl.vars.IfVar $IF} variable for if-else block logic.
  - $SWITCH variable for switch block logic.
  - Whitespace wasn't being ignored in some cases.
- {@link oaj.html.HtmlParser} can now parse full body contents generated by {@link oaj.html.HtmlDocSerializer}.
- Parse-args supported added to {@link oaj.msgpack.MsgPackParser} to allow it to be used in remoteable proxies.
- Added some convenience classes for constructing collections using a fluent interface:
  - {@del AList}
  - {@del ASet}
  - {@del AMap}
- New {@link oaj.annotation.Bean#typePropertyName @Bean(typePropertyName)} annotation allows you to specify the name of the "_type" property at the class level.
- New methods added to HTML5 container beans:
  - {@link oaj.dto.html5.HtmlElementContainer#getChild(int...)}
  - {@link oaj.dto.html5.HtmlElementMixed#getChild(int...)}
- New common serializer setting: {@del SerializerContext#SERIALIZER_abridged}.
- Support for defining interface proxies against 3rd-party REST interfaces.
  New package {@del org.apache.juneau.remoteable} for all remoteable proxy interface annotations.
  @Remoteable annotation has been moved to this package.
- Updated doc: 6 - Remoteable Services
- New doc: 6.1 - Interface proxies against 3rd-party REST interfaces
- New URL-encoding serializer setting: {@del UrlEncodingSerializerContext#URLENC_paramFormat}.
- New methods on {@link oaj.urlencoding.UrlEncodingSerializer.Builder}:
  - {@del UrlEncodingSerializer.Builder#paramFormat(String)}
  - {@del UrlEncodingSerializer.Builder#plainTextParams()}

##### org.apache.juneau.rest

- {@del @RestResource} annotation can now be applied to any class! You're no longer restricted to subclassing your resources from {@del oajr.RestServlet}.
  This is a major enhancement in the API. Anything you could do by subclassing from RestServlet should have an equivalent for non-RestServlet classes.
  The only restriction is that the top-level resource must subclass from RestServlet. Child resources do not.
  The majority of code has been split up into two separate classes:
  - {@del RestConfig} - A modifiable configuration of a resource. Subclasses from {@link javax.servlet.ServletConfig}.
  - {@link oajr.RestContext} - A read-only configuration that's the result of a snapshot of the config.
  The {@del oajr.RestServlet} class now has the following initialization method that allows you to override the config settings define via annotations:
  - {@del RestServlet#init(RestConfig)} - A modifiable configuration of a resource.
  Non-RestServlet classes must have one of the following to allow it to be instantiated:
  - A public T(RestConfig) constructor.
  - A public T() constructor.
  - The parent resource must have a customized {@del oajr.RestResourceResolver} for instantiating it.
  Non-RestServlet classes can optionally include the following init methods to gain access to the config and context:
  - public init(RestConfig)
  - public init(RestContext)
- New annotations added to {@del @RestResource} to allow non-RestServlet resources to do the same as subclassing directly from RestServlet:
  - {@del RestResource#resourceResolver()} - Specify a {@del oajr.RestResourceResolver} class for resolving child resources.
  - {@del RestResource#callHandler()} - Specify a {@del oajr.RestCallHandler} class for handling the lifecycle of a REST call.
  - {@del RestResource#infoProvider()} - Specify a {@del oajr.RestInfoProvider} class for customizing title/description/Swagger information on a REST resource.
  - {@del RestResource#logger()} - Specify a {@del oajr.RestLogger} class for handling logging.
- New annotations added to {@del @RestResource} and {@del oajr.annotation.RestMethod @RestMethod} to simplify defining page title, text, and links on HTML views:
  - {@del @RestResource(pageTitle)}
  - {@del @RestMethod(pageTitle)}
  - {@del @RestResource(pageText)}
  - {@del @RestMethod(pageText)}
  - {@del @RestResource(pageLinks)}
  - {@del @RestMethod(pageLinks)}

  // Old method @RestResource( properties={ @Property(name=HTMLDOC_title, value="System properties resource"), @Property(name=HTMLDOC_description, value="REST interface for performing CRUD operations on system properties."), @Property(name=HTMLDOC_navlinks, value="{up:'$R{requestParentURI}',options:'?method=OPTIONS'}") } ) // New method @RestResource( pageTitle="System properties resource", pageDescription="REST interface for performing CRUD operations on system properties.", pageLinks="{up:'$R{requestParentURI}',options:'?method=OPTIONS'}" )

  Typically you're going to simply want to use the title and description annotations which apply to both the page title/text and the swagger doc:

  @RestResource( title="System properties resource", description="REST interface for performing CRUD operations on system properties.", pageLinks="{up:'$R{requestParentURI}',options:'?method=OPTIONS'}" )

- {@del RestResource#stylesheet()} can now take in a comma-delimited list of stylesheet paths.
- {@del StreamResource} can now contain multiple sources from a variety of source types (e.g. byte[] arrays, InputStreams, Files, etc...) and is now immutable. It also includes a new {@del StreamResourceBuilder} class.
- Simplified remoteable proxies using the @RestMethod(name="PROXY") annotation on REST methods. Used to expose interface proxies without the need for {@del RemoteableServlet}.

  // Server side @RestMethod(name="PROXY", path="/myproxy/*") public IAddressBook getProxy() { return addressBook; } // Client side RestClient client = RestClient.create().rootUrl(samplesUrl).build(); IAddressBook ab = client.getRemoteableProxy(IAddressBook.class, "/addressBook/myproxy");

  See {@del oajr.annotation.RestMethod#name() @RestMethod(name)} for more information.
- {@link oajr.RestRequest#toString()} can be called at any time to view the headers and content of the request without affecting functionality. Very useful for debugging.
- {@del oajr.annotation.RestMethod#name() @RestMethod(name)} annotation is now optional. Defaults to "GET".

##### org.apache.juneau.rest.client

- Revamped the client API to use builders.
- New doc: 1.5 - Debugging
- The RestClient class doX(Object url) methods now handle HttpClient URIBuilder instances.
- New methods added/updated to {@link oajrc.RestClient}:
  - {@del RestClient#getRemoteableProxy(Class,Object)} - For interface proxies defined using @RestMethod(name="PROXY").
  - {@del RestClient#getRemoteableProxy(Class,Object,Serializer,Parser)} - Same as above, but overrides the serializer and parser defined on the client.
  - {@del RestClient#doPost(Object)}
  - {@del RestClient#doCall(HttpMethod,Object,Object)} - Can now pass in instances of {@del oajrc.NameValuePairs} for easy form posts.
    This extends to all methods that take in the input.
- New methods on {@del oajrc.RestCall}:
  - {@del oajrc.RestCall#uri(Object) uri(Object)}
  - {@del query(String,Object,boolean,PartSerializer)}
  - {@del oajrc.RestCall#query(String,Object) query(String,Object)}
  - {@del oajrc.RestCall#queryIfNE(String,Object) queryIfNE(String,Object)}
  - {@del oajrc.RestCall#query(Map) query(Map)}
  - {@del oajrc.RestCall#queryIfNE(Map) queryIfNE(Map)}
  - {@del oajrc.RestCall#query(String) query(String)}
  - {@del formData(String,Object,boolean,PartSerializer)}
  - {@del oajrc.RestCall#formData(String,Object) formData(String,Object)}
  - {@del oajrc.RestCall#formDataIfNE(String,Object) formDataIfNE(String,Object)}
  - {@del oajrc.RestCall#formData(Map) formData(Map)}
  - {@del oajrc.RestCall#formDataIfNE(Map) formDataIfNE(Map)}
  - {@del header(String,Object,boolean,PartSerializer)}
  - {@del oajrc.RestCall#header(String,Object) header(String,Object)}
  - {@del oajrc.RestCall#headerIfNE(String,Object) headerIfNE(String,Object)}
  - {@del oajrc.RestCall#headers(Map) headers(Map)}
  - {@del oajrc.RestCall#headersIfNE(Map) headersIfNE(Map)}
  - {@del oajrc.RestCall#host(String) host(String)}
  - {@del oajrc.RestCall#port(int) port(int)}
  - {@del oajrc.RestCall#userInfo(String,String) userInfo(String,String)}
  - {@del oajrc.RestCall#userInfo(String) userInfo(String)}
  - {@del oajrc.RestCall#scheme(String) scheme(String)}
- New methods added to {@link oajrc.RestClient.Builder}:
  - {@link oajrc.RestClient.Builder#executorService(ExecutorService,boolean) executorService(ExecutorService,boolean)}
  - {@del RestClient.Builder#paramFormat(String)}
  - {@del RestClient.Builder#plainTextParams()}
  - {@link oajrc.RestClient.Builder#noTrace() noTrace()} - Adds a No-Trace: true header on all requests to prevent the servlet from logging errors.
    Useful for testing scenarios when you don't want the console to end up showing errors done on purpose.
  - {@link oajrc.RestClient.Builder#debug() debug()} now adds a Debug: true header on all requests.
- New methods added/updated to {@del oajrc.RestCall}:
  - {@del oajrc.RestCall#runFuture() runFuture()}
  - {@del oajrc.RestCall#getResponseFuture(Class) getResponseFuture(Class)}
  - {@del oajrc.RestCall#getResponseFuture(Type,Type...) getResponseFuture(Type,Type...)}
  - {@del oajrc.RestCall#getResponseAsStringFuture() getResponseAsStringFuture()}
  - {@del oajrc.RestCall#serializer(Serializer) serializer(Serializer)} - Override the serializer defined on the client for a single call.
  - {@del oajrc.RestCall#parser(Parser) parser(Parser)} - Override the parser defined on the client for a single call.
  - {@del input(Object)} - Now accepts instances of {@del oajrc.NameValuePairs}.
  - {@del oajrc.RestCall#getResponse(Class) getResponse(Class)} - Can now pass in any of the following:
    - {@link org.apache.http.HttpResponse} - Returns the raw HttpResponse returned by the inner HttpClient.
    - {@link java.io.Reader} - Returns access to the raw reader of the response.
    - {@link java.io.InputStream} - Returns access to the raw input stream of the response.
- New methods added to {@del oajrc.NameValuePairs}:
  - {@del oajrc.NameValuePairs#append(String,Object) append(String,Object)}
  - {@del append(String,Object,PartSerializer)}
- {@del oajrc.RetryOn} is now an abstract class with an additional method:
  - {@del oajrc.RetryOn#onResponse(HttpResponse) onResponse(HttpResponse)}

##### org.apache.juneau.microservice

- "REST/port" configuration setting can now be a comma-limited list of port numbers to try.
  You can also specify one or more 0s to try a random port.
- Methods added to {@del RestMicroservice} class:
  - {@del getPort()}
  - {@del getURI()}
  - Override methods added from {@link oaj.microservice.Microservice} class for easier method chaining.