Skip to main content

Release 7.1.0

Date: Mar 08, 2018

Version 7.1.0 is a major update with major implementation refactoring across all aspects of the product.

juneau-marshall

  • Significant improvements made to the internals of the Serializer and Parser classes.

    • Caching improvements on serializers and parsers have reduced execution time of the core JUnits by approximately 1/3. The 17000+ JUnit tests now execute in less than 10 seconds and have a cache-reuse hit rate of 98% (164104 serializers/parsers/bean-contexts retrieved but only 1801 created from scratch).

    • All the various separate Context classes (e.g. JsonSerializerContext) have been folded into their respective serializer or parser classes (e.g. JsonSerializer). Additionally, these classes are their own bean contexts. For example, the class hierarchy of JsonSerializer is now:

      ContextBeanContextSerializerWriterSerializerJsonSerializer

      All Context objects are thread-safe and read-only.

    • Session objects also now have a consistent class hierarchy. For example, the class hierarchy of JsonSerializerSession is now:

      SessionBeanSessionSerializerSessionWriterSerializerSessionJsonSerializerSession

      Session objects are transient objects that live for the duration of a single parse.

    • Builder objects also now have a consistent class hierarchy. For example, the class hierarchy of JsonSerializer.Builder is now:

      Context.BuilderBeanContext.BuilderSerializer.BuilderWriterSerializer.BuilderJsonSerializer.Builder

      Builder objects are used for building up and creating Context objects.

    • The PropertyStore class has been completely rewritten. It is now a read-only configuration store build using the PropertyStoreBuilder class. The previous PropertyStore class was overly-complicated with many read/write locks to ensure thread-safety. The new design shifts to a builder-based model with read-only PropertyStore objects that can be used as hash keys.

  • Improvements to the HTTP-Part APIs. The existing PartSerializer/PartParser classes have been replaced with the following all located in the new org.apache.juneau.httppart package:

    org.apache.juneau.httppartHttpPartTypeHttpPartSerializerUonPartSerializerSimpleUonPartSerializerSimplePartSerializerHttpPartParserUonPartParserSimplePartParser

    Code for marshalling of parts have been removed from the URL-Encoding serializers and parsers.

  • Context.Builder.property(String,Object) renamed to Builder.set(String,Object).

  • ResourceFinder class has been replaced with the following:

    • ClasspathResourceFinder
    • ClasspathResourceFinderSimple
    • ClasspathResourceFinderBasic
    • ClasspathResourceFinderRecursive
    • ClasspathResourceManager
  • New methods on SerializerSession:

  • New methods on ParserSession:

  • New Parser.PARSER_unbuffered setting allows you to disable internal buffering on the JSON and UON parsers so that they can be used to read continuous streams of objects.

  • New JsonParser.JSON_validateEnd and UonParser.UON_validateEnd settings allow you to control whether we validate that there is no garbage at the end of the parsed input.

  • New Parser.PARSER_autoCloseStreams setting allows input streams and readers passed into parsers to be automatically closed after parsing.

  • Syntax changed on unswap method on Surrogate classes. It's now a regular method instead of a static method.

  • @Swap annotation can now be used with Surrogate classes.

  • New support for POJO Builders.

juneau-svl

juneau-config

  • The Config API has been completely revamped. New features include:

    • Support for pluggable storage.
    • File-system watcher integration support. Changes made to file system files now automatically reflected in configurations and interface proxies.
    • New builder-based design.

juneau-dto

  • Enhancements to Swagger DTO:

juneau-rest-server

  • RestServletDefault renamed to BasicRestServlet.

  • RestServletGroupDefault renamed to BasicRestServletGroup.

  • The "$R{...}" variable has been split into the following:

    • "$RA{key1[,key2...]}" - RequestAttributeVar, first non-null value returned by HttpServletRequest.getAttribute(String).

    • "$RF{key1[,key2...]}" - RequestFormDataVar, first non-null value returned by RestRequest.getFormData(String).

    • "$RH{key1[,key2...]}" - RequestHeaderVar, first non-null value returned by RestRequest.getHeader(String).

    • "$RI{key1[,key2...]}" - RestInfoVar, first non-null value returned by RestRequest.getInfoProvider(). The possible values are:

      • "contact" - Value returned by Info.getContact()
      • "description" - Value returned by RestInfoProvider.getDescription(RestRequest)
      • "externalDocs" - Value returned by Swagger.getExternalDocs()
      • "license" - Value returned by Info.getLicense()
      • "methodDescription" - Value returned by RestInfoProvider.getMethodDescription(Method,RestRequest)
      • "methodSummary" - Value returned by RestInfoProvider.getMethodSummary(Method,RestRequest)
      • "siteName" - Value returned by RestInfoProvider.getSiteName(RestRequest)
      • "tags" - Value returned by Swagger.getTags()
      • "termsOfService" - Value returned by Info.getTermsOfService()
      • "title" - See RestInfoProvider.getTitle(RestRequest)
      • "version" - See Info.getVersion()
    • "$RP{key1[,key2...]}" - RequestPathVar, first non-null value returned by RestRequest.getPath(String).

    • "$RQ{key1[,key2...]}" - RequestQueryVar, first non-null value returned by RestRequest.getQuery(String).

    • "$R{key1[,key2...]}" - RequestVar, first non-null other request variable. The possible values are:

  • Refactored the RestConfig class into RestContext.Builder. Settings on RestContext objects can now be set declaratively through the following new properties:

    • RestContext.REST_allowHeaderParams
    • RestContext.REST_allowBodyParam
    • RestContext.REST_allowedMethodParams
    • RestContext.REST_renderResponseStackTraces
    • RestContext.REST_useStackTraceHashes
    • RestContext.REST_defaultCharset
    • RestContext.REST_maxInput
    • RestContext.REST_paramResolvers
    • RestContext.REST_converters
    • RestContext.REST_guards
    • RestContext.REST_responseHandlers
    • RestContext.REST_defaultRequestHeaders
    • RestContext.REST_defaultResponseHeaders
    • RestContext.REST_produces
    • RestContext.REST_consumes
    • RestContext.REST_clientVersionHeader
    • RestContext.REST_resourceResolver
    • RestContext.REST_logger
    • RestContext.REST_callHandler
    • RestContext.REST_infoProvider
    • RestContext.REST_path
    • RestContext.REST_contextPath
    • RestContext.REST_staticFiles
    • RestContext.REST_staticFileResponseHeaders
    • RestContext.REST_classpathResourceFinder
    • RestContext.REST_useClasspathResourceCaching
    • RestContext.REST_widgets
    • RestContext.REST_mimeTypes
  • Support for static files has been simplified and improved.

    • Syntax on @RestResource(staticFiles) has been simplified, and now allows you to specify response headers in the strings.
    • Response headers for static files can also be configured through RestContext.REST_staticFileResponseHeaders
    • Static file in-memory caching now configurable through RestContext.REST_useClasspathResourceCaching
    • Static file retrieval can be customized through RestContext.REST_classpathResourceFinder
  • Eliminated the RestMatcherReflecting class. You can now simply create a RestMatcher that has a public constructor that takes in the server and method arguments.

  • @RestResource.allowMethodParam renamed to @RestResource.allowedMethodParams.

  • @RestMethod.serializersInherit and @RestMethod.parsersInherit replaced with simplified @RestMethod(inherit).

  • Changes to RequestFormData:

    • RequestFormData.addDefault(Map) takes in a Map<String,Object> instead of Map<String,String>.
  • Changes to RequestHeaders:

    • RequestHeaders.addDefault(Map) takes in a Map<String,Object> instead of Map<String,String>.
  • Changes to RequestQuery:

    • RequestQuery.addDefault(Map) takes in a Map<String,Object> instead of Map<String,String>.
  • Changes to RestContext:

    • getResource(String,Locale) renamed to getClasspathResource(String,Locale)
    • getResourceAsString(String,Locale) renamed to getClasspathResourceAsString(String,Locale)
    • getResource(Class,MediaType,String,Locale) renamed to getClasspathResourceAsString(Class,MediaType,String,Locale)
    • New method getClasspathResource(Class,String,Locale).
    • New method getClasspathResourceAsString(Class,String,Locale).
    • New method getClasspathResource(Class,Class,MediaType,String,Locale).
    • RestContext.getDefaultRequestHeaders() returns a Map<String,Object> instead of Map<String,String>.
    • RestContext.getDefaultResponseHeaders() returns a Map<String,Object> instead of Map<String,String>.
  • Changes to RestRequest:

    • getSupportedMediaTypes() replaced with RestRequest.getConsumes() and RestRequest.getProduces().
    • getReaderResource(String,boolean,MediaType) renamed to getClasspathReaderResource(String,boolean,MediaType)
    • getReaderResource(String,boolean) renamed to getClasspathHttpResource(String,boolean)
    • getReaderResource(String) renamed to getClasspathHttpResource(String)
  • Changes to @RestResource

    • New mimeTypes() annotation.
  • Changes to @RestMethod:

    • New RestMethod.consumes() and RestMethod.produces() for overriding the supported media types inferred from the serializers and parsers.
  • RestCallHandler split up into RestCallHandler and BasicRestCallHandler

  • RestInfoProvider split up into RestInfoProvider and BasicRestInfoProvider

  • RestLogger split up into RestLogger, BasicRestLogger and NoOpRestLogger

  • RestResourceResolverSimple renamed to BasicRestResourceResolver

  • Introduced the following classes that helps make the code more understandable:

    • RestContextProperties
    • RestMethodProperties
    • RequestProperties
  • Eliminated the @Messages and @Properties REST java method parameter annotations. These aren't needed anymore since you can just pass in MessageBundle and RestRequestProperties as unannotated parameters.

  • Revamped the RestInfoProvider class.

  • New builder classes:

    • ReaderResourceBuilder
    • StreamResourceBuilder
  • RestResponse.getNegotiatedOutputStream() now returns a FinishableServletOutputStream and RestResponse.getNegotiatedWriter() now returns a FinishablePrintWriter that allows you to finish the output without closing the stream. The DefaultHandler class now calls finish() instead of close() on the stream.

  • Added the following annotations to the BasicRestServlet class (which were previously defined on the Resource class):

    @RestResource(
    htmldoc=@HtmlDoc(
    navlinks={
    "up: request:/..",
    "options: servlet:/?method=OPTIONS"
    },
    stylesheet="$C{REST/stylesheet,servlet:/styles/devops.css}"
    ),

    // Optional external configuration file.
    config="$S{juneau.configFile}"
    )

juneau-rest-client

  • New configuration property RestClient.RESTCLIENT_query and builder method Builder.query(String,Object).

  • API changes to replace PartSerializer with HttpPartSerializer. The default value is now SimpleUonPartSerializer which will serialize strings as plain-text and collections/arrays as comma-delimited lists. We decided to change the default behavior in favor of practicality over purity.

  • New methods on RestCall class:

    • RestCall.getResponseHeader(String)
    • RestCall.getResponseCode()
  • RestCall and RestClient now implement the Closeable interface.

juneau-microservice

  • Resource and ResourceGroup classes removed. BasicRestServlet and BasicRestServletGroup can be used instead.

  • ResourceJena and ResourceJenaGroup classes renamed to BasicRestServletJena and BasicRestServletJenaGroup.