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
Contextclasses (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 ofJsonSerializeris now:Context BeanContext Serializer WriterSerializer JsonSerializer All
Contextobjects are thread-safe and read-only. -
Session objects also now have a consistent class hierarchy. For example, the class hierarchy of
JsonSerializerSessionis now:SessionBeanSession SerializerSession WriterSerializerSession 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.Builderis now:Context.Builder BeanContext.Builder Serializer.Builder WriterSerializer.Builder JsonSerializer.Builder Builder objects are used for building up and creating
Contextobjects. -
The
PropertyStoreclass has been completely rewritten. It is now a read-only configuration store build using thePropertyStoreBuilderclass. The previousPropertyStoreclass was overly-complicated with many read/write locks to ensure thread-safety. The new design shifts to a builder-based model with read-onlyPropertyStoreobjects that can be used as hash keys.
-
-
Improvements to the HTTP-Part APIs. The existing
PartSerializer/PartParserclasses have been replaced with the following all located in the neworg.apache.juneau.httppartpackage:org.apache.juneau.httppart HttpPartType HttpPartSerializer UonPartSerializerSimpleUonPartSerializerSimplePartSerializer HttpPartParser UonPartParserSimplePartParserCode for marshalling of parts have been removed from the URL-Encoding serializers and parsers.
-
Context.Builder.property(String,Object)renamed toBuilder.set(String,Object). -
ResourceFinderclass has been replaced with the following:ClasspathResourceFinderClasspathResourceFinderSimpleClasspathResourceFinderBasicClasspathResourceFinderRecursiveClasspathResourceManager
-
New methods on SerializerSession:
-
New methods on ParserSession:
-
New
Parser.PARSER_unbufferedsetting 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_validateEndandUonParser.UON_validateEndsettings allow you to control whether we validate that there is no garbage at the end of the parsed input. -
New
Parser.PARSER_autoCloseStreamssetting allows input streams and readers passed into parsers to be automatically closed after parsing. -
Syntax changed on unswap method on
Surrogateclasses. It's now a regular method instead of a static method. -
@Swap annotation can now be used with
Surrogateclasses. -
New support for
POJO Builders.
juneau-svl
-
New variables:
-
Variables moved from juneau-microservice:
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:
-
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
-
RestServletDefaultrenamed toBasicRestServlet. -
RestServletGroupDefaultrenamed toBasicRestServletGroup. -
The
"$R{...}"variable has been split into the following:-
"$RA{key1[,key2...]}"- RequestAttributeVar, first non-null value returned byHttpServletRequest.getAttribute(String). -
"$RF{key1[,key2...]}"- RequestFormDataVar, first non-null value returned byRestRequest.getFormData(String). -
"$RH{key1[,key2...]}"- RequestHeaderVar, first non-null value returned by RestRequest.getHeader(String). -
"$RI{key1[,key2...]}"-RestInfoVar, first non-null value returned byRestRequest.getInfoProvider(). The possible values are:"contact"- Value returned by Info.getContact()"description"- Value returned byRestInfoProvider.getDescription(RestRequest)"externalDocs"- Value returned by Swagger.getExternalDocs()"license"- Value returned by Info.getLicense()"methodDescription"- Value returned byRestInfoProvider.getMethodDescription(Method,RestRequest)"methodSummary"- Value returned byRestInfoProvider.getMethodSummary(Method,RestRequest)"siteName"- Value returned byRestInfoProvider.getSiteName(RestRequest)"tags"- Value returned by Swagger.getTags()"termsOfService"- Value returned by Info.getTermsOfService()"title"- SeeRestInfoProvider.getTitle(RestRequest)"version"- See Info.getVersion()
-
"$RP{key1[,key2...]}"- RequestPathVar, first non-null value returned byRestRequest.getPath(String). -
"$RQ{key1[,key2...]}"- RequestQueryVar, first non-null value returned byRestRequest.getQuery(String). -
"$R{key1[,key2...]}"- RequestVar, first non-null other request variable. The possible values are:"contextPath"- Value returned by RestRequest.getContextPath()"method"- Value returned by RestRequest.getMethod()"methodDescription"- Value returned byRestRequest.getMethodDescription()"methodSummary"- Value returned byRestRequest.getMethodSummary()"pathInfo"- Value returned byRestRequest.getPathInfo()"requestParentURI"- Value returned by UriContext.getRootRelativePathInfoParent()"requestURI"- Value returned byRestRequest.getRequestURI()"resourceDescription"- Value returned byRestRequest.getResourceDescription()"resourceTitle"- SeeRestRequest.getResourceTitle()"servletParentURI"- Value returned by UriContext.getRootRelativeServletPathParent()"servletPath"- See RestRequest.getServletPath()"servletURI"- See UriContext.getRootRelativeServletPath()"siteName"- SeeRestRequest.getSiteName()
-
-
Refactored the
RestConfigclass into RestContext.Builder. Settings on RestContext objects can now be set declaratively through the following new properties:RestContext.REST_allowHeaderParamsRestContext.REST_allowBodyParamRestContext.REST_allowedMethodParamsRestContext.REST_renderResponseStackTracesRestContext.REST_useStackTraceHashesRestContext.REST_defaultCharsetRestContext.REST_maxInputRestContext.REST_paramResolversRestContext.REST_convertersRestContext.REST_guardsRestContext.REST_responseHandlersRestContext.REST_defaultRequestHeadersRestContext.REST_defaultResponseHeadersRestContext.REST_producesRestContext.REST_consumesRestContext.REST_clientVersionHeaderRestContext.REST_resourceResolverRestContext.REST_loggerRestContext.REST_callHandlerRestContext.REST_infoProviderRestContext.REST_pathRestContext.REST_contextPathRestContext.REST_staticFilesRestContext.REST_staticFileResponseHeadersRestContext.REST_classpathResourceFinderRestContext.REST_useClasspathResourceCachingRestContext.REST_widgetsRestContext.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
- Syntax on
-
Eliminated the
RestMatcherReflectingclass. You can now simply create aRestMatcherthat has a public constructor that takes in the server and method arguments. -
@RestResource.allowMethodParamrenamed to@RestResource.allowedMethodParams. -
@RestMethod.serializersInheritand@RestMethod.parsersInheritreplaced with simplified@RestMethod(inherit). -
Changes to
RequestFormData:RequestFormData.addDefault(Map)takes in aMap<String,Object>instead ofMap<String,String>.
-
Changes to
RequestHeaders:RequestHeaders.addDefault(Map)takes in aMap<String,Object>instead ofMap<String,String>.
-
Changes to
RequestQuery:RequestQuery.addDefault(Map)takes in aMap<String,Object>instead ofMap<String,String>.
-
Changes to RestContext:
getResource(String,Locale)renamed togetClasspathResource(String,Locale)getResourceAsString(String,Locale)renamed togetClasspathResourceAsString(String,Locale)getResource(Class,MediaType,String,Locale)renamed togetClasspathResourceAsString(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 aMap<String,Object>instead ofMap<String,String>.RestContext.getDefaultResponseHeaders()returns aMap<String,Object>instead ofMap<String,String>.
-
Changes to RestRequest:
getSupportedMediaTypes()replaced withRestRequest.getConsumes()andRestRequest.getProduces().getReaderResource(String,boolean,MediaType)renamed togetClasspathReaderResource(String,boolean,MediaType)getReaderResource(String,boolean)renamed togetClasspathHttpResource(String,boolean)getReaderResource(String)renamed togetClasspathHttpResource(String)
-
Changes to
@RestResource- New
mimeTypes()annotation.
- New
-
Changes to
@RestMethod:- New
RestMethod.consumes()andRestMethod.produces()for overriding the supported media types inferred from the serializers and parsers.
- New
-
RestCallHandlersplit up intoRestCallHandlerandBasicRestCallHandler -
RestInfoProvidersplit up intoRestInfoProviderandBasicRestInfoProvider -
RestLoggersplit up intoRestLogger,BasicRestLoggerandNoOpRestLogger -
RestResourceResolverSimplerenamed toBasicRestResourceResolver -
Introduced the following classes that helps make the code more understandable:
RestContextPropertiesRestMethodPropertiesRequestProperties
-
Eliminated the
@Messagesand@PropertiesREST java method parameter annotations. These aren't needed anymore since you can just pass inMessageBundleandRestRequestPropertiesas unannotated parameters. -
Revamped the
RestInfoProviderclass. -
New builder classes:
ReaderResourceBuilderStreamResourceBuilder
-
RestResponse.getNegotiatedOutputStream() now returns a
FinishableServletOutputStreamand RestResponse.getNegotiatedWriter() now returns aFinishablePrintWriterthat allows you to finish the output without closing the stream. TheDefaultHandlerclass now callsfinish()instead ofclose()on the stream. -
Added the following annotations to the
BasicRestServletclass (which were previously defined on theResourceclass):@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 methodBuilder.query(String,Object). -
API changes to replace
PartSerializerwith HttpPartSerializer. The default value is nowSimpleUonPartSerializerwhich 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)RestCall.getResponseCode()
-
RestCalland RestClient now implement theCloseableinterface.
juneau-microservice
-
ResourceandResourceGroupclasses removed.BasicRestServletandBasicRestServletGroupcan be used instead. -
ResourceJenaandResourceJenaGroupclasses renamed toBasicRestServletJenaandBasicRestServletJenaGroup.
Share feedback or follow-up questions for this page directly through GitHub.