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:
- {@link oaj.Context}
- {@link oaj.BeanContext}
- {@link oaj.serializer.Serializer}
- {@link oaj.serializer.WriterSerializer}
- {@link oaj.json.JsonSerializer}
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:
Session
- {@link oaj.BeanSession}
- {@link oaj.serializer.SerializerSession}
- {@link oaj.serializer.WriterSerializerSession}
- {@link oaj.json.JsonSerializerSession}
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:
- {@link oaj.Context.Builder}
- {@link oaj.BeanContext.Builder}
- {@link oaj.serializer.Serializer.Builder}
- {@link oaj.json.JsonSerializer.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:
- {@link oaj.httppart}
- {@link oaj.httppart.HttpPartType}
- {@link oaj.httppart.HttpPartSerializer}
UonPartSerializer
SimpleUonPartSerializer
- {@link oaj.httppart.SimplePartSerializer}
- {@link oaj.httppart.HttpPartParser}
UonPartParser
SimplePartParser
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 {@link oaj.serializer.SerializerSession}:
- {@link oaj.serializer.SerializerSession#getListener() getListener()}
- {@link oaj.serializer.SerializerSession#getListener(Class) getListener(Class)}
-
New methods on {@link oaj.parser.ParserSession}:
- {@link oaj.parser.ParserSession#getListener() getListener()}
- {@link oaj.parser.ParserSession#getListener(Class) getListener(Class)}
-
New
Parser.PARSER_unbufferedsetting allows you to disable internal
buffering on the JSON and UON parsers so that they can be used to read continous streams of objects.
-
New
JsonParser.JSON_validateEndand 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.
-
{@link oaj.annotation.Swap @Swap} annotation can now be used with
Surrogateclasses.
-
New support for
PojoBuilders POJO Builders.
juneau-svl
-
New variables:
- {@link oaj.svl.vars.CoalesceVar}
- {@link oaj.svl.vars.PatternMatchVar}
- {@link oaj.svl.vars.NotEmptyVar}
- {@link oaj.svl.vars.UpperCaseVar}
- {@link oaj.svl.vars.LowerCaseVar}
-
Variables moved from juneau-microservice:
- {@link oaj.svl.vars.ArgsVar}
- {@link oaj.svl.vars.ManifestFileVar}
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:
- New methods for setting and retrieving properties via name:
- {@link oaj.dto.swagger.SwaggerElement#get(String,Class)}
- {@link oaj.dto.swagger.SwaggerElement#set(String,Object)}
-
Support for setting non-standard fields such as "$ref" via getter and setter
above.
-
Setter methods that take in beans and collections of beans can now take in
JSON strings.
juneau-rest-server
-
RestServletDefault renamed to
BasicRestServlet.
-
RestServletGroupDefault renamed to
BasicRestServletGroup.
-
The "$R{...}" variable has been split into the following:
- "$RA{key1[,key2...]}" - {@link oajr.vars.RequestAttributeVar}, first non-null value returned by HttpServletRequest.getAttribute(String).
- "$RF{key1[,key2...]}" - {@link oajr.vars.RequestFormDataVar}, first non-null value returned by
RestRequest.getFormData(String).
- "$RH{key1[,key2...]}" - {@link oajr.vars.RequestHeaderVar}, first non-null value returned by {@link oajr.RestRequest#getHeader(String)}.
- "$RI{key1[,key2...]}" -
RestInfoVar, first non-null value returned by RestRequest.getInfoProvider().
The possible values are:
- "contact" - Value returned by {@link oaj.dto.swagger.Info#getContact()}
- "description" - Value returned by
RestInfoProvider.getDescription(RestRequest)
- "externalDocs" - Value returned by {@link oaj.dto.swagger.Swagger#getExternalDocs()}
- "license" - Value returned by {@link oaj.dto.swagger.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 {@link oaj.dto.swagger.Swagger#getTags()}
- "termsOfService" - Value returned by {@link oaj.dto.swagger.Info#getTermsOfService()}
- "title" - See
RestInfoProvider.getTitle(RestRequest)
- "version" - See {@link oaj.dto.swagger.Info#getVersion()}
- "$RP{key1[,key2...]}" - {@link oajr.vars.RequestPathVar}, first non-null value returned by
RestRequest.getPath(String).
- "$RQ{key1[,key2...]}" - {@link oajr.vars.RequestQueryVar}, first non-null value returned by
RestRequest.getQuery(String).
- "$R{key1[,key2...]}" - {@link oajr.vars.RequestVar}, first non-null other request variable.
The possible values are:
- "contextPath" - Value returned by {@link oajr.RestRequest#getContextPath()}
- "method" - Value returned by {@link oajr.RestRequest#getMethod()}
- "methodDescription" - Value returned by
RestRequest.getMethodDescription()
- "methodSummary" - Value returned by
RestRequest.getMethodSummary()
- "pathInfo" - Value returned by {@link oajr.RestRequest#getPathInfo()}
- "requestParentURI" - Value returned by {@link oaj.UriContext#getRootRelativePathInfoParent()}
- "requestURI" - Value returned by {@link oajr.RestRequest#getRequestURI()}
- "resourceDescription" - Value returned by
RestRequest.getResourceDescription()
- "resourceTitle" - See
RestRequest.getResourceTitle()
- "servletParentURI" - Value returned by {@link oaj.UriContext#getRootRelativeServletPathParent()}
- "servletPath" - See {@link oajr.RestRequest#getServletPath()}
- "servletURI" - See {@link oaj.UriContext#getRootRelativeServletPath()}
- "siteName" - See
RestRequest.getSiteName()
-
Refactored the RestConfig class into {@link oajr.RestContext.Builder}.
Settings on {@link oajr.RestContext} objects can now be set declaratively through the
following new properties:
RestContext.REST_allowHeaderParams
RestContext.REST_allowBodyParam
RestContext.REST_allowedMethodParams REST_allowedMethodParams
RestContext.REST_renderResponseStackTraces REST_renderResponseStackTraces
RestContext.REST_useStackTraceHashes
RestContext.REST_defaultCharset REST_defaultCharset
RestContext.REST_maxInput REST_maxInput
RestContext.REST_paramResolvers
RestContext.REST_converters REST_converters
RestContext.REST_guards REST_guards
RestContext.REST_responseHandlers
RestContext.REST_defaultRequestHeaders
RestContext.REST_defaultResponseHeaders
RestContext.REST_produces REST_produces
RestContext.REST_consumes REST_consumes
RestContext.REST_clientVersionHeader REST_clientVersionHeader
RestContext.REST_resourceResolver
RestContext.REST_logger
RestContext.REST_callHandler
RestContext.REST_infoProvider
RestContext.REST_path REST_path
RestContext.REST_contextPath
RestContext.REST_staticFiles 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.allowMethodParamrenamed to RestResource.allowedMethodParams.
-
@RestMethod.serializersInherit and @RestMethod.parsersInherit replaced with
simplified
@RestMethod(inherit).
-
Changes to
RequestFormData:
RequestFormData.addDefault(Map) addDefault(Map)takes in a
Map<String,Object> instead of Map<String,String>.
-
Changes to
RequestHeaders:
RequestHeaders.addDefault(Map) addDefault(Map)takes in a
Map<String,Object> instead of Map<String,String>.
-
Changes to
RequestQuery:
RequestQuery.addDefault(Map) addDefault(Map)takes in a
Map<String,Object> instead of Map<String,String>.
-
Changes to {@link oajr.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 {@link oajr.RestRequest}:
- getSupportedMediaTypes() replaced with
RestRequest.getConsumes() getConsumes()and
RestRequest.getProduces() 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 @RestMethod:
- New
RestMethod.consumes() consumes()and
RestMethod.produces() 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
RestInfoProviderclass.
-
New builder classes:
ReaderResourceBuilder
StreamResourceBuilder
-
{@link oajr.RestResponse#getNegotiatedOutputStream()} now returns a
FinishableServletOutputStreamand {@link oajr.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_queryand
builder method Builder.query(String,Object).
-
API changes to replace PartSerializer with {@link oaj.httppart.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
RestCallclass:
RestCall.getResponseHeader(String) getResponseHeader(String)
RestCall.getResponseCode() getResponseCode()
-
RestCall and {@link oajrc.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
BasicRestServletJenaand BasicRestServletJenaGroup.