Release Notes 7.x
This page collects every release in the 7.x line, newest first.
Release 7.2.2
Date: Nov 7, 2018
This release contains minor bug fixes and general improvements to the PetStore sample application.
Release 7.2.1
Date: Oct 23, 2018
This release contains mostly bug fixes. Code changes have been made to preserve binary backwards compatibility with 7.1.0.
juneau-marshall
-
The
@JsonSchemaannotation has been merged with the@Schemaannotation. -
Annotations typically used on bean properties (getters/setters/public fields) can now be used on private fields. This is inline with behavior on JPA-annotated beans. These include:
@Swap,@Html,@Xml,@BeanProperty.
juneau-rest-server
-
Method-level annotations (e.g.
@RestMethod) and parameter-level annotations (e.g.@Query) are now inheritable from parent classes and interfaces. This allows you to defineRestcDualPurposeInterfaces. -
The
ReaderResourceandStreamResourceclasses have been moved to theorg.apache.juneau.httppackage in juneau-marshall. This allows them to be used as return types in remote REST interfaces. A newResolvingReaderResourceclass has been added that includes the variable-resolving support since this relies on the juneau-svl package. -
The
RemoteInterfaceServletclass has been renamed to RrpcServlet. -
@RestMethod(name="PROXY")has been changed to@RestMethod(name="RRPC").
juneau-rest-client
-
The
RestClient.getRemoteInterface()method has been renamed to RestClient.getRrpcInterface(Class). -
Fixed a bug where
@RemoteMethod(path)values containing/characters were erroneously being encoded.
Release 7.2.0
Date: Sept 25, 2018
7.2.0 is a major release that introduces several significant new features:
- OpenAPI part serializing and parsing with full support for OpenAPI validation of input and output in the REST servlet and client APIs.
- Swagger UI.
- New HTTP-Part annotations that are applicable to both the servlet and client APIs.
- Serverless servlet and client unit testing.
- Simplified UI customization.
- Marshalls that combines serializers and parsers into a single API.
juneau-marshall
-
The REST client
@Remoteableannotations and REST server@RemoteMethodannotations which used to be in separate packages in the client and server projects have been combined into a single set of annotations in the org.apache.juneau.http.annotation package. This fixes a long-standing problem where it was easy to mix up using client-side annotations in server-side code, and vis-versa. Additionally, much work has been done on these annotations to add support for Swagger-style validations and documentation.HTTP Part Annotations: @BodyFormData Header Path Query HasFormData HasQuery Request These are used with new Swagger schema/documentation annotations to produce schema-based serialization/parsing/validation and auto-generated Swagger documentation:
Swagger Schema Annotations: Contact ExternalDocsItemsLicense SchemaSubItemsTagAdditionally, the
@Remoteableannotation has been split into the following two annotations:@RemoteInterface- Used for remote proxy interfaces served up throughRemoteInterfaceServletor REST"PROXY"methods. Defaults to"POST"with method signatures as paths.@RemoteResource- Used for 3rd-party REST interfaces. Defaults to"GET"with standardized naming conventions for paths.
-
Support for multi-valued parameters as maps or beans on server-side annotations (it was previously supported on client-side):
@Query("*"),@FormData("*"),@Header("*"),@Path("*") -
Support for server-side use of
@Requestannotation on@RestMethodannotations and new RestRequest.getRequest(RequestBeanMeta) method. -
Fixed bug where
@Bean(typeName)was not being detected on non-bean POJO classes. -
Fixed bug where HTML-Schema was not being rendered correctly.
-
Support for POJO examples:
BeanContext.BEAN_examples@Example -
Fixed bug where parsers could report the wrong line number when an error occurred.
-
A runtime exception is now thrown if you define a
@BeanProperty(name)but forget to add it to your@Bean(properties)annotation. -
@Html(asXml)and@Html(asPlainText)replaced with @Html(format). -
HTML serializer will now serializers beans and maps as HTML even when those objects are embedded within an object with
@Html(format=XML). The previous behavior was to serialize it as XML. -
New settings for binary-based serializers and parsers:
OutputStreamSerializer.OSSERIALIZER_binaryFormatInputStreamParser.ISPARSER_binaryFormat -
Added support for auto-detection of fluent-style setters:
BeanContext.BEAN_fluentSettersBean.fluentSetters() -
The
SERIALIZER_abridgedsetting has been replaced withSerializer.SERIALIZER_addRootType -
The
SERIALIZER_addBeanTypePropertiessetting has been replaced withSerializer.SERIALIZER_addBeanTypesand is disabled by default. -
Parse exception messages are now clearer and include code snippets of where a parse exception occurred:
org.apache.juneau.parser.ParseException: Expected '[' at beginning of JSON array.
At line 80, column 20.
While parsing into:
currentClass: List<String>
currentProperty: required: java.util.List, field=[null], getter=[public java.util.List org.apache.juneau.dto.swagger.SchemaInfo.getRequired()], setter=[public org.apache.juneau.dto.swagger.SchemaInfo org.apache.juneau.dto.swagger.SchemaInfo.setRequired(java.util.Collection)]
---start--
0075: "name": "body",
0076: "description": "Pet object that needs to be added to the store",
0077: "required": true,
0078: "schema": {
0079: "required": true,
0080: }
0081: }
0082: ],
0083: "responses": {
0084: "405": {
0085: "description": "Invalid input"
---end--- -
New property
Parser.PARSER_debugOutputLinesfor controlling how many input lines are added to the exception message above. -
New property
BeanContext.BEAN_useEnumNamesfor controlling whether enums are serialized using their name or thetoString()method. -
New property
BeanContext.BEAN_examplesfor defining examples of POJOs. -
New @Example annotation for defining examples of POJOs. Used heavily in JSON-Schema support.
-
If a bean has both a
getX()andisX()method, thegetX()method takes precedence. The previous behavior was arbitrary. -
Significant improvements to JSON-Schema serialization support.
- New
@JsonSchemaannotation.
- New
-
Fixed
NullPointerExceptionwhen serializing beans with a dyna-property (i.e.@Bean("*")) which returns anullvalue. -
New option for dyna-property (i.e.
@Bean("*")) using a method that returns a collection of extra keys. See new options #4 onBeanProperty.name() -
New formats for the @Html(format) annotation:
- Format collections as comma-delimited lists.HtmlFormat.HTML_CDC - Format collections as space-delimited lists.HtmlFormat.HTML_SDC -
Serializers now allow for q-values on the media types they handle. For example, the accept media type on
JsonSerializer.Simpleis"application/json+simple,application/json;q=0.9". This means the serializer CAN handle requests for"application/json"if no other serializers provide a better match. -
New methods for creating unmodifiable
ObjectMapsandObjectLists.ObjectMapObjectMap.isUnmodifiable()ObjectMap.unmodifiable()ObjectMap.modifiable()ObjectListObjectList.isUnmodifiable()ObjectList.unmodifiable()ObjectList.modifiable() -
The
JsonSerializer.Simpleclass has been moved into the top-levelSimpleJsonSerializerclass. -
RDF serializer subclasses have been moved into top-level classes:
RdfSerializer.Xml→RdfXmlSerializerRdfSerializer.XmlAbbrev→RdfXmlAbbrevSerializerRdfSerializer.N3→N3SerializerRdfSerializer.NTriple→NTripleSerializerRdfSerializer.Turtle→TurtleSerializerRdfParser.Xml→RdfXmlParserRdfParser.N3→N3ParserRdfParser.NTriple→NTripleParserRdfParser.Turtle→TurtleParser
-
New API for pairing serializers and parsers for simplified syntax:
Examples:
// Using instance.
Json json = new Json();
MyPojo myPojo = json.read(string, MyPojo.class);
String string = json.write(myPojo);// Using DEFAULT instance.
MyPojo myPojo = Json.DEFAULT.read(string, MyPojo.class);
String string = Json.DEFAULT.write(myPojo);MarshallCharMarshallHtmlJsonPlainTextSimpleJsonUonUrlEncodingXmlN3NTripleRdfXmlRdfXmlAbbrevTurtleStreamMarshallJsoMsgPack -
New/updated documentation:
2.15.3 - Simplified JSON
juneau-dto
-
Fixed bug where Swagger
SchemaInfo.required(Object...)was defined as a boolean instead of a list of strings. -
Boolean attributes are now handled correctly for HTML5. For example, calling
new Select().disabled(true)will produce<select disabled='disabled'>
juneau-rest-server
-
Auto-generated
Swagger UI. -
Simplified
@RestResource(swagger)and@RestMethod(swagger)annotations. -
Fixed bug in
UriResolverwhen request path info had special characters. -
Fixed bug where incorrect media type was being set on responses (e.g.
text/html+schemainstead oftext/htmlfor schema documents). -
The
RemoteableServletclass has been moved and renamed toRemoteInterfaceServlet. -
RemoteInterfaceServletnow provides a form page for invoking remote interface methods in a browser. -
Newlines were being stripped from
@HtmlDoc(script)when serialized which could cause script lines to become commented out. -
New @Response annotation that can be applied to throwables thrown from REST methods and POJOs returned by REST methods to specify non-200 status return codes and descriptions in Swagger documentation.
-
Swagger fields added to the following annotations:
HTTP Part Annotations with Swagger Support: @BodyFormData Header Path Query -
The
@PathRemainderannotation has been removed entirely. Use@Path("/*")to access the path remainder which includes all the new OpenAPI parsing support. -
"Helper" classes (i.e. reusable beans that can be returned by REST methods) have been moved to the following package with some new additions:
org.apache.juneau.rest.helperBeanDescriptionChildResourceDescriptionsReaderResourceReaderResourceBuilderSeeOtherRootResourceDescriptionStreamResourceStreamResourceBuilder -
Predefined HTTP responses.
org.apache.juneau.rest.responseAcceptedAlreadyReportedContinueCreatedEarlyHintsFoundIMUsedMovedPermanentlyMultipleChoicesMultiStatusNoContentNonAuthoritiveInformationNotModifiedOkPartialContentPermanentRedirectProcessingResetContentSeeOtherSwitchingProtocolsTemporaryRedirectUseProxy -
Predefined HTTP error throwables. When added to REST Java methods, reflected in generated Swagger documentation.
org.apache.juneau.rest.exceptionBadRequestConflictExpectationFailedFailedDependencyForbiddenGoneHttpVersionNotSupportedInsufficientStorageInternalServerErrorLengthRequiredLockedLoopDetectedMethodNotAllowedMisdirectedRequestNetworkAuthenticationRequiredNotAcceptableNotExtendedNotFoundNotImplementedPayloadTooLargePreconditionFailedPreconditionRequiredRangeNotSatisfiableRequestHeaderFieldsTooLargeServiceUnavailableTooManyRequestsUnauthorizedUnavailableForLegalReasonsUnprocessableEntityUnsupportedMediaTypeUpgradeRequiredUriTooLongVariantAlsoNegotiates -
The
@HtmlDoc(nav)and@HtmlDoc(navlinks)can now both be used on the same annotation. The contents ofnav()are free-form HTML that gets rendered immediately after the navigation links. -
The following new parameter types can be used on REST methods:
ReaderParser - The reader parser matching the request content type.InputStreamParser - The input stream parser matching the request content type. -
The
$Fvariable can now be used as a initialization time variable. For example, theAtomFeedResourceexample pulls a bean example from a file on the classpath:@RestResource(
path="/atom",
title="Sample ATOM feed resource",
properties={
@Property(name=BEAN_examples, value="{'org.apache.juneau.dto.atom.Feed': $F{AtomFeedResource_example.json}}")
},
...
)It should be noted that you cannot use the
$Fvariable to retrieve localized versions of files (since you're not within the scope of a client request. -
The
RestResource.nowrap()annotation has been changed to a string with a default value of"true". Having it as a string allows us to differentiate between a set and unset value so that it can be overridden in subclasses. -
The @Path.name() annotation parameter is now required.
-
New class for mock unit testing of REST resources:
MockRest -
@RestMethod(inherit)annotation has been removed and replaced with the following classes:Inheritance Control Classes: InheritNoneThese can be used in the following locations:
@RestResource.serializers()@RestResource.parsers()@RestResource.beanFilters()@RestResource.pojoSwaps()@RestMethod.serializers()@RestMethod.parsers()@RestMethod.beanFilters()@RestMethod.pojoSwaps()One advantage is that you now have control over the precedence of serializers and parsers by where you insert the
Inheritclass. -
RequestPathMatchclass has been renamed toRequestPath. -
@Request objects can now be used as parameters in
@RestMethodmethods. Includes new methods on RestRequest:getRequest(Class) getRequest(RequestBeanMeta) -
New methods added to MenuItemWidget to allow population of menu item content using Javascript and Ajax calls:
MenuItemWidget getBeforeShowScript(RestRequest)getAfterShowScript(RestRequest) -
New methods added to Widget to allow retrieving classpath resources with embedded SVL variables:
Widget loadHtmlWithVars(RestRequest,String)loadScriptWithVars(RestRequest,String)loadStyleWithVars(RestRequest,String) -
New/updated documentation:
juneau-rest-server.UnitTesting -
The behavior of the default values for
RestMethod.name()andRestMethod.path()have changed. If not specified, the values are inferred from the Java method name. See Also:RestMethod -
RedirectToServletRootclass has been renamed toSeeOtherRoot. -
New REST context settings:
RestContext RestContext.REST_uriAuthorityRestContext.REST_uriContextRestContext.REST_uriRelativityRestContext.REST_uriResolution -
New convenience annotations for specifying default
AcceptandContent-Typeheaders:@RestResourcedefaultAcceptdefaultContentType@RestMethodRestMethod.defaultAcceptRestMethod.defaultContentType
juneau-rest-client
-
Remote Resource interfaces support OpenAPI annotations.
-
Made improvements to the builder API for defining SSL support. New methods added:
RestClient.Builder RestClient.Builder.sslProtocols(String...)RestClient.Builder.cipherSuites(String...)Builder.hostnameVerifier(HostnameVerifier)RestClient.Builder.keyManagers(KeyManager...)RestClient.Builder.trustManagers(TrustManager...)Builder.secureRandom(SecureRandom)Builder.httpClientConnectionManager(HttpClientConnectionManager) -
Clients no longer have JSON defined as the default serializer and parser. Instead, the clients can now be used with no serializer/parser if you're working with InputStreams/Readers or POJOs that can be converted to Strings and converted from Strings/InputStreams/Readers.
-
Methods added to client builder to make it easy to define the transport language:
RestClient.Builder json() xml() html() uon() urlEnc() msgPack() plainText() -
New method added for allowing serverless client testing against REST interfaces.
RestClient.Builder mockHttpConnection(MockHttpConnection) -
Removed the deprecated
RestCall.execute()method. UseRestCall.run(). -
RestCall.input(Object)method renamed toRestCall.body(Object)to match OpenAPI terminology. -
Made constructors on RestClient and RestClient.Builder protected so that they can be subclassed.
-
The
RestClient.getRemoteableProxy()methods have been split into separate methods for Remote Interfaces and Remote Resources:RestClient RestClient.getRemoteInterface(Class)RestClient.getRemoteInterface(Class,Object)RestClient.getRemoteInterface(Class,Object,Serializer,Parser)RestClient.getRemoteResource(Class)RestClient.getRemoteResource(Class,Object)RestClient.getRemoteResource(Class,Object,Serializer,Parser)
juneau-rest-microservice
-
The look-and-feel of an application is now controlled through the external configuration file and access to CSS stylesheets in the working directory in a new folder called
files:
The default configuration is this:
#=======================================================================================================================
# REST settings
#=======================================================================================================================
[REST]
staticFiles = htdocs:files/htdocs
# Stylesheet to use for HTML views.
theme = servlet:/htdocs/themes/devops.css
headerIcon = servlet:/htdocs/images/juneau.png
headerLink = http://juneau.apache.org
footerIcon = servlet:/htdocs/images/asf.png
footerLink = http://www.apache.org
icon = $C{REST/headerIcon}
header = <a href='$U{$C{REST/headerLink}}'><img src='$U{$C{REST/headerIcon}}' style='position:absolute;top:5;right:5;background-color:transparent;height:30px'/></a>
footer = <a href='$U{$C{REST/footerLink}}'><img style='float:right;padding-right:20px;height:32px' src='$U{$C{REST/footerIcon}}'>Note that static files can now be served up from the
filesdirectory in the working directory, and you have access to modify the CSS theme files. TheSwaggerUI.cssfile controls the look-and-feel of the Swagger UI, so you can make modification there as well.The
BasicRestConfiginterface (which defines the default settings for theBasicRestServletclass) now looks like this...@RestResource(
...
htmldoc=@HtmlDoc(
header={
"<h1>$R{resourceTitle}</h1>",
"<h2>$R{methodSummary,resourceDescription}</h2>",
"$C{REST/header}"
},
navlinks={
"up: request:/.."
},
stylesheet="$C{REST/theme,servlet:/htdocs/themes/devops.css}",
head={
"<link rel='icon' href='$U{$C{REST/icon}}'/>"
},
footer="$C{REST/footer}"
),
// These are static files that are served up by the servlet under the specified sub-paths.
// For example, "/servletPath/htdocs/javadoc.css" resolves to the file "[servlet-package]/htdocs/javadoc.css"
staticFiles={"$C{REST/staticFiles}"}
)
public interface BasicRestConfig {}The
PoweredByApachewidget which used to serve as a page footer has been eliminated.If you're testing out changes in the theme stylesheets, you may want to set the following system property that prevents caching of those files so that you don't need to restart the microservice each time a change is made:
#=======================================================================================================================
# System properties
#=======================================================================================================================
[SystemProperties]
# Disable classpath resource caching.
# Useful if you're attached using a debugger and you're modifying classpath resources while running.
RestContext.useClasspathResourceCaching.b = false -
Upgraded to Jetty 9.4.12.
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.
Release 7.0.1
Date: Dec 24, 2017
This release is a minor update. It includes the following prereq updates:
- Apache HttpClient: 4.5.3 to 4.5.4
- Eclipse Jetty: 9.4.6.v20170531 to 9.4.8.v20171121
juneau-marshall
-
New static
create()methods for builders on serializers and parsers. This simplifies the syntax of creation of serializers and parsers by scratch.// Old way
JsonSerializer s1 = new JsonSerializer.Builder().ws().build();
// New way
JsonSerializer s2 = JsonSerializer.create().ws().build();The same static create methods have also been added to the following classes:
SerializerGroup.create()ParserGroup.create()EncoderGroup.create()- RestClient.create()
ConfigFile.create()
-
The order of the parameters in SerializerSession.serialize(Object,Object) has been changed to match Serializer.serialize(Object,Object).
-
Fixed some bugs in the XML parser related to whitespace and comments.
juneau-svl
-
New methods on Var class to restrict when nested and embedded variables are resolved.
juneau-rest-server
- New
@RestResource(maxInput)and@RestMethod(maxInput)for alleviating potential DoS attacks.
juneau-microservice-server
-
New pluggable console commands. When you start up the microservice, you'll now see the following:
Running class 'RestMicroservice' using config file 'examples.cfg'.
Server started on port 10000
List of available commands:
exit -- Shut down service
restart -- Restarts service
help -- Commands help
echo -- Echo command
> help help
NAME
help -- Commands help
SYNOPSIS
help [command]
DESCRIPTION
When called without arguments, prints the descriptions of all available commands.
Can also be called with one or more arguments to get detailed information on a command.
EXAMPLES
List all commands:
> help
List help on the help command:
> help help
>Commands are pluggable and extensible through the config file.
#=======================================================================================================================
# Console settings
#=======================================================================================================================
[Console]
enabled = true
# List of available console commands.
# These are classes that implements ConsoleCommand that allow you to submit commands to the microservice via
# the console.
# When listed here, the implementations must provide a no-arg constructor.
# They can also be provided dynamically by overriding the Microservice.createConsoleCommands() method.
commands =
org.apache.juneau.microservice.console.ExitCommand,
org.apache.juneau.microservice.console.RestartCommand,
org.apache.juneau.microservice.console.HelpCommand-
New classes:
-
New methods on Microservice:
- startConsole()
createConsoleCommands()- getConsoleReader()
- getConsoleWriter()
-
-
Console input reader and output writer can now be overridden.
-
Console strings are now internationalized.
Release 7.0.0
Date: Oct 25, 2017
This release ups the Java prerequisite to Java 7.
juneau-marshall
- New class
HttpMethodNamewith valid static string HTTP method names.
juneau-dto
- Class
org.apache.juneau.dto.Linkrenamed to LinkString. Helps avoid confusion since there are other Link classes in the library.
juneau-rest-server
-
Annotation
@HtmlDoc(links)renamed to@HtmlDoc(navlinks). -
New annotation
@HtmlDoc(head). Allows you to specify arbitrary HTML content in the<head>section of the page. -
Removed annotation
@HtmlDoc(favIcon). This was a discouraged way of defining fav-icons anyway, and with the addition of@HtmlDoc(head), you can define them using:head={
"<link rel='icon' href='$U{servlet:/htdocs/juneau.png}'/>"
} -
Removed several of the HTMLDOC-related methods from the
RestResponse/RestConfig/RestContextclasses and moved it into the newHtmlDocBuilderclass.