Release Notes 8.x
This page collects every release in the 8.x line, newest first.
Release 8.2.0
Date: Oct 14, 2020
Juneau 8.2.0 is a major release.
The most significant change is the addition of an entirely new RestClient API build from scratch with near 100% unit test coverage.
The new API is located in the org.apache.juneau.rest.client2 package and will replace the old API in 9.0.
juneau-marshall
-
@Bean and @BeanIgnore annotations can alternately occur in parent class hierarchy. The first one found dictates whether a class is ignored as a bean or not.
-
Applying the @Bean annotation on a class will now force non-public classes to be interpreted as beans. For example, applying @Bean to a
privateclass will force it to be treated as a bean. Also, if a public bean constructor cannot be found, the default constructor will be used regardless of it's visibility if the @Bean annotation is on the class. -
The
@Beancannotation can now be recognized and used on non-public constructors. -
Annotations are now aggregated across the entire class hierarchy instead of simply being overridden.
The following is an example.
// Parent class with properties a,b,c
@Bean(bpi="a,b,c")
public class MyClass {
public int a, b, c, d;
}
// New behavior: Child class with properties a,c because @Beans are aggregated.
// Old behavior: Child class with properties a,c,d because @Bean is overridden.
@Bean(bpx="b")
public class MyChildClass extends MyClass {
public int a, b, c, d;
} -
Include/exclude/read-only/write-only properties defined on the bean context now override those defined on annotations of the class itself. For example, the following methods override the @Bean annotations on classes:
BeanContext.Builder bpi(Class,String)bpi(String,String)bpx(Class,String)bpx(String,String)bpro(Class,String)bpro(String,String)bpwo(Class,String)bpwo(String,String) -
Config annotations now override class-level annotations. For example, only the 'a' and 'b' properties get serialized on the bean below:
// Parent class with properties a,b,c
@Bean(bpi="a,b,c")
public class MyClass {
public int a, b, c, d;
}
@RestMethod
@BeanConfig(beanApply={@Bean(on="MyClass",bpi="a,b")}
public MyClass getMyClass() {...} -
The following concrete annotation implementation classes are now provided that can be used with the BeanContext.Builder.annotations(Annotation...) method:
BeanAnnotation implements @BeanBeancAnnotation implements @BeancBeanIgnoreAnnotation implements @BeanIgnoreBeanpAnnotation implements @BeanpExampleAnnotation implements @ExampleNamePropertyAnnotation implements @NamePropertyParentPropertyAnnotation implements @ParentPropertySwapAnnotation implements @SwapUriAnnotation implements@URICsvAnnotation implements @CsvHtmlAnnotation implements @Html implementsJsoAnnotation@JsoJsonAnnotation implements @Json implementsSchemaAnnotation@SchemaMsgPackAnnotation implements @MsgPackOpenApiAnnotation implements @OpenApiPlainTextAnnotation implements @PlainTextSoapXmlAnnotation implements @SoapXmlUonAnnotation implements @UonUrlEncodingAnnotation implements @UrlEncodingXmlAnnotation implements @XmlExample:
@Bean(bpi="street,city") // Will be overridden
public class AddressBean {...}
Bean ba = new BeanAnnotation("AddressBean").bpi("street,city,state");
WriterSerializer ws = JsonSerializer.create().annotations(ba).build();
String json = ws.toString(addressBean); // Will print street,city,statePlus similar annotation classes for other serializer/parser annotations.
-
The BeanContext.Builder.annotations(Annotation...) method can be used to apply annotations to classes during runtime.
-
Bean maps now have the concept of "hidden" properties (properties that aren't serialized but otherwise accessible). For example, the @Html.link can now reference hidden properties:
@Bean(bpi="a") // Will be overridden
public class MyBean {
@Html(link="servlet:/{b}")
public String a;
public String b; // Not serialized but referenced in link on a.
}The general rule for the BeanMap class is that
get(),put(), andcontainsKey()will work against hidden properties butkeySet()andentrySet()will skip them. -
Several bug fixes in the HtmlSerializer and HtmlParser classes around the handling of collections and arrays of beans with
@Bean(typeName)annotations. -
New swaps auto-added to all serializers/parsers:
MatchResultSwapStackTraceElementSwap -
@Html.noTableHeaders now can be applied to collections of beans.
-
New @HtmlDocConfig.asideFloat setting so that you can position the contents of the aside section on the page.
-
Various minor fixes surrounding HTML serialization:
- Collections of beans that were supposed to be serialized as tables were being serialized as lists.
- Collections of beans with
@Bean(bpi)were not being serialized in the correct column order.
-
Fixed a bug where a copy constructor can erroneously be recognized as a builder constructor if the class also has a static
createmethod. Net effect was that the copy constructor would needlessly be called during parsing. -
New org.apache.juneau.collections package containing various convenience fluent-style collection classes:
AListASetASortedSetAMapASortedMapOMapOList -
ObjectMapis being deprecated and replaced withOMap. -
ObjectListis being deprecated and replaced withOList. -
All classes in the org.apache.juneau.http.response and
exceptionnow haveheader(String,Object)methods for adding response headers.// Method that performs a BASIC Auth handshake.
@RestMethod
public Ok checkBasicAuth(@Header("Authorization") String auth) throws Unauthorized {
if (auth == null)
throw new Unauthorized().header("WWW-Authenticate", "BASIC realm=\"foo\"");
return Ok.OK;
} -
New annotations for multi-part support:
Header.multi()Query.multi()FormData.multi() -
BeanTraverseContext.BEANTRAVERSE_ignoreRecursionssetting no longer requiresBeanTraverseContext.BEANTRAVERSE_detectRecursionsto be enabled. -
Fixed bug in JSON/UON/URL-Encoding serializers where indentation was not correct of first line when
BeanTraverseContext.BEANTRAVERSE_initialDepthused. -
Fixed bug in JSON/UON/URL-Encoding serializers where properties past the max depth were being serialized as null instead of being treated as null and not being serialized at all.
-
Fixed bug in HTML serializer where tables of maps were not sorted if
SERIALIZER_sortMapswas specified. -
SERIALIZER_trimNullPropertieshas been replaced withSerializer.SERIALIZER_keepNullProperties SERIALIZER_keepNullProperties. -
Improvements to OpenAPI serializer and parser:
- Collection format can now be specified on OBJECTs to allow key/value pairs to be delimited with the same support as ARRAYs.
- New
OpenApiCommon.OAPI_format OAPI_formatandOpenApiCommon.OAPI_collectionFormat OAPI_collectionFormatproperties.
-
Convenience methods added to HttpPartSchema and related classes to simplify schema definitions:
import static org.apache.juneau.httppart.HttpPartSchema.*;
// Old
HttpPartSchema s = schema("object")
.property("f01", schema("array").collectionFormat("pipes").items(schema("string")))
.property("f02", schema("array").collectionFormat("pipes").items(schema("string", "byte")))
.property("f03", schema("array").collectionFormat("pipes").items(schema("string", "date-time")))
.build();
// New
HttpPartSchema s = tObject()
.p("f01", tArray(tString()))
.p("f02", tArray(tByte()))
.p("f03", tArray(tDateTime()))
.build(); -
Fixes where the bean method/constructor visibility wasn't being used when finding swap methods and constructors.
-
HTML-Schema support is being deprecated due to low-use and difficulty in maintaining. It will be removed in 9.0.
-
JuneauLoggerclass is being deprecated. Improvements in logging in Java 8 make it obsolete. -
Bean filters can now be specified programmatically through a builder API.
// Create a JSON serializer that only includes specified fields on a specific class.
WriterSerializer s = JsonSerializer
.create()
.beanFilters(BeanFilter.create(MyBean.class).bpi("foo,bar,baz").build())
.build(); -
BeanContext.REST_pojoSwapsreplaced withBeanContext.BEAN_swaps(and builder methods as well). -
New
RootBeanPropertyMetaclass added for when you needBeanPropertyMetafrom somewhere and all you have is a Class. -
New Bean Property Interceptor API for intercepting calls to bean getters/setters.
BeanInterceptor@Bean.interceptor BeanContext.Builder.beanInterceptor(Class,Class) -
Fluent setters that follow the
withXconvention are now automatically detected by all parsers.// A bean with a fluent setter.
public class MyBean {
public MyBean withFoo(String foo) {
this.foo = foo;
return this;
}
}Note you could previously use the
@BeanPropertyannotation to identify these setters.
juneau-rest-server
-
New
RestContext.REST_context REST_context/Rest.context() @Rest(context)setting to allow you to extend the RestContext class. -
@Rest-annotated classes can now implement the following interfaces directly instead of having to define secondary classes and hook them up through annotations:
- Normally defined throughRestCallHandler@Rest.callHandler() - Normally defined throughRestInfoProvider@Rest.infoProvider() - Normally defined throughRestCallLogger@Rest.callLogger() - Normally defined throughClasspathResourceFinder@Rest.classpathResourceFinder()The methods added for
RestInfoProviderare:RestServletgetSwagger(RestRequest)getSiteName(RestRequest)getTitle(RestRequest)getDescription(RestRequest)getMethodSummary(Method,RestRequest)getMethodDescription(Method,RestRequest)BasicRestgetSwagger(RestRequest)getSiteName(RestRequest)getTitle(RestRequest)getDescription(RestRequest)getMethodSummary(Method,RestRequest)getMethodDescription(Method,RestRequest)The methods added for
RestCallLoggerare:RestServletRestServlet.log(RestCallLoggerConfig,HttpServletRequest,HttpServletResponse) log(RestCallLoggerConfig,HttpServletRequest,HttpServletResponse)BasicRestBasicRest.log(RestCallLoggerConfig,HttpServletRequest,HttpServletResponse) log(RestCallLoggerConfig,HttpServletRequest,HttpServletResponse)The methods added for
ClasspathResourceFinderare:RestServletRestServlet.findResource(Class,String,Locale) findResource(Class,String,Locale)BasicRestBasicRest.findResource(Class,String,Locale) findResource(Class,String,Locale)The methods added for
RestResourceResolverare:RestServletoajr.RestServlet.resolve(Object,Class,RestContext.Builder,Object...) resolve(Object,Class,RestContext.Builder,Object...)BasicRest -
Added the following convenience hook methods on the
RestServletandBasicRestclasses:RestServletoajr.RestServlet.onInit(RestContext.Builder) onInit(RestContext.Builder)RestServlet.onPostInit(RestContext) onPostInit(RestContext)RestServlet.onPostInitChildFirst(RestContext) onPostInitChildFirst(RestContext)RestServlet.onDestroy(RestContext) onDestroy(RestContext)RestServlet.onStartCall(HttpServletRequest,HttpServletResponse) onStartCall(HttpServletRequest,HttpServletResponse)RestServlet.onPreCall(RestRequest,RestResponse) onPreCall(RestRequest,RestResponse)RestServlet.onPostCall(RestRequest,RestResponse) onPostCall(RestRequest,RestResponse)RestServlet.onEndCall(HttpServletRequest,HttpServletResponse) onEndCall(HttpServletRequest,HttpServletResponse)BasicRestoajr.BasicRest.onInit(RestContext.Builder) onInit(RestContext.Builder)BasicRest.onPostInit(RestContext) onPostInit(RestContext)BasicRest.onPostInitChildFirst(RestContext) onPostInitChildFirst(RestContext)BasicRest.onDestroy(RestContext) onDestroy(RestContext)BasicRest.onStartCall(HttpServletRequest,HttpServletResponse) onStartCall(HttpServletRequest,HttpServletResponse)BasicRest.onPreCall(RestRequest,RestResponse) onPreCall(RestRequest,RestResponse)BasicRest.onPostCall(RestRequest,RestResponse) onPostCall(RestRequest,RestResponse)BasicRest.onEndCall(HttpServletRequest,HttpServletResponse) onEndCall(HttpServletRequest,HttpServletResponse) -
New @Rest.debugOn annotation for turning on debug mode using class/method identifiers:
// Turn on debug per-request on the class and always on the doX() method.
@Rest(
debugOn="MyResource=per-request,Mysource.doX=true" // Typically defined via system or env property.
)
public class MyResource {
@RestMethod
public void String doX() {
...
}
} -
BasicRestConfighas been broken up intoBasicRestConfigandBasicRestMethodsso that you're not forced to implement methods such asgetOptions()andgetStats()if you're implementing the interface to configure your REST class. -
Any of the following classes can now be instantiated with
public static create()methods:RestCallHandlerRestCallLoggerRestInfoProviderClasspathResourceFinderRestResourceResolverRestGuardResponseHandler -
New
Path.required() @Path(required)annotation support. A path can be marked as not-required when the path variable is resolved by a parent resource like so:@Rest(path="/parent/{p1}",children=Child.class)
public class Parent {
...
}
@Rest(path="/child")
public class Child {
@RestMethod(path="/")
public String doGet(@Path(name="p1",required=false) String p1) {
// p1 will be null when accessed via "/child"
// p1 will be non-null when accessed via "/parent/p1/child".
}
...
}This allows the child resource to be mapped to multiple parents that may resolve various different path variables.
-
New
RestMethod.paths() @RestMethod(paths)annotation that allows you to map multiple paths to the same Java method.Example:
@RestMethod(
name=GET,
paths={"/","/{foo}"}
)
public String doGet(@Path(name="foo",required=false) String foo) {...} -
The
RestMethod @RestMethodannotation is now implied on all unannotated methods of a @Rest @Rest-annotated interface.@Rest
public interface MyRest {
String getFoo(); // @RestMethod(name=GET,path="/foo") is implied.
} -
Improved
RestContext.REST_messages REST_messagessupport (mostly bug fixes).
juneau-rest-server-springboot
-
JuneauRestInitializernow provides a no-arg constructor so that it can be used in the@ConfigurationContext(initializers=JuneauRestInitializer.class)when unit testing using@SpringBootTest. -
New
ResourceDescription.ResourceDescription(String,String,String)constructor andResourceDescriptions.append(String,String,String)method. -
New
Hyperlinkclass.
juneau-rest-client
-
Completely revamped RestClient API.
- All APIs now extend from HttpClient interfaces.
- Better integration with HttpClient.
- New fluent-style methods with many new convenience methods.
- Updated juneau-rest-client.
-
@RemoteMethod-annotated methods can now return Future and CompletableFuture for concurrent processing of requests.Example:
@Remote
public interface MyInterface {
public Future<String> doGet();
}
MyInterface i = client.getRemote(MyInterface.class, "http://localhost:12345/myInterface");
Future<String> f = i.doGet();
// Do other stuff.
String result = f.get(); -
Additions to @Remote annotation:
- @Remote.version - Adds a client version header to all requests.
- @Remote.headers - Adds a set of headers to all requests.
headerSupplier- Adds a dynamic supplier of headers to all requests.
juneau-rest-mock
- The
MockRestandMockRemoteclasses have been remove entirely and all existing functions have been moved into the improvedMockRestClientclass. All REST test mocking can be done through this single class.
Release 8.1.3
Date: Jan 20, 2020
Juneau 8.1.3 is a moderate release.
juneau-marshall
-
Dynamically applied annotations:
DynamicallyAppliedAnnotations -
Better representation of nulls for XML and HTML content properties.
- Old:
"<myBean><null></myBean>" - New:
"<myBean nil='true'></myBean>"
- Old:
-
Configurable properties such as
Context.CONTEXT_debugcan now be set globally by either system properties or environment variables. ForCONTEXT_debugyou can use either the system propertyContext.debugor environment variablesCONTEXT_DEBUG. -
Fixed an initialization time race condition that can cause initial parse errors when concurrently parsing into array types like so:
JsonParser.DEFAULT.parse(input, MyBean[].class);
juneau-rest-server
-
Fixed bug in
BasicRestCallHandlerwhere if you have the following REST methods...@RestMethod(name="GET", path="/foo")
@RestMethod(name="*", path="/bar")...and you tried to make a GET request to /bar, you'd erroneously get a 404 error instead of matching the 2nd method.
-
Fixed an issue involving using Juneau REST with Spring Security. When Spring Security cannot authenticate a request, it sets the URL on the request to
"/error"with a 401 status. When Juneau then processes this request, it cannot find that mapping and changes the status to 404 which messes with HTTP clients. Solution was to add a default no-op error method to theBasicRestConfig(and implementers):@RestMethod(name="*", path="/error")
public void error() {} -
Fixed a bug where
@RestResource(debug="true")wouldn't log requests if a@RestMethod-annotated method was not matched. -
Renamed the following annotations:
@Rest(attrs)→@Rest(reqAttrs)@Rest(defaultRequestHeaders)→@Rest(reqHeaders)@Rest(defaultResponseHeaders)→@Rest(resHeaders)@RestMethod(attrs)→@RestMethod(reqAttrs)@RestMethod(defaultRequestHeaders)→@RestMethod(reqHeaders)
-
New auto-generated REST method execution statistics:
RestExecutionStatistics
juneau-rest-client
- Several convenience methods defined in RestClient.Builder that were deprecated in 8.1.2 have been undeprecated in this release due to user feedback.
juneau-doc
- New auto-generated glossary of all configurable properties:
GlossaryConfigurableProperties
Release 8.1.2
Date: Dec 01, 2019
Juneau 8.1.2 is a moderate release.
juneau-marshall
-
Support for read-only and write-only properties.
@Bean.bpro()@Bean.bpwo()@Beanp.ro() @Beanp.wo() BEAN_bproBEAN_bpwoBuilder.bpro(Map)Builder.bpwo(Map) -
New convenience methods:
ObjectMap.parse(CharSequence)ObjectList.parse(CharSequence) -
CharMarshallandStreamMarshallnow have public constructors. -
@Beanp replaces
@BeanProperty. -
@Beanc replaces
@BeanConstructor. -
@Remote replaces
@RemoteResource. -
Shortened names for @Bean(dictionary) and BeanContext.Builder.beanDictionary(Class...).
juneau-rest-server
-
@Rest replaces
@RestResourcewith shorter syntax. -
New method
RestResponse.setHeaderSafe(String,String)to strip invalid characters from header values. -
Fixed issues related to invalid characters being set on HTTP header values.
juneau-rest-client
-
RestClient is now extendible. The constructor has been made public and simplified to:
RestClient(RestClient.Builder). -
Duplicate methods between RestClient.Builder and HttpClientBuilder have been made deprecated on the former. This eliminates the need to try to keep the two builder classes in sync.
Release 8.1.1
Date: Sept 20, 2019
Juneau 8.1.1 is a minor release but introduces some new features/modifications.
juneau-marshall
-
Support for serializing/parsing Optional objects and bean properties.
-
Fixed a bug in the parsers where the generic subtype of a complex bean property type involving both collections and arrays was not being found. (e.g.
List<Long>[]) -
New packages of HTTP response/exceptions beans from
juneau-rest-serverbundle and REST proxy annotations fromjuneau-rest-clientso that they can be used when building REST proxy interfaces while only pulling in the marshall bundle.org.apache.juneau.http.response org.apache.juneau.http.exceptionorg.apache.juneau.http.remote
These replace the org.apache.juneau.rest.response, org.apache.juneau.rest.exception, and org.apache.juneau.rest.client.remote packages.
-
Defaulting SVL variables now won't ignore additional parameters.
"$S{Foo,bar,baz}"used to default to"bar"but now will default to"bar,baz". -
Ranking support has been added to all
@XConfigannotations. This allows you to override the normal precedence of application of config annotations on class and method hierarchies.
juneau-rest-server
-
Support for Optional on method parameters annotated with @Header, @FormData, @Query, @Path.
-
Fixed issue where
RestMethod.debug()annotation wasn't resulting in the HTTP request being logged. -
RestExceptionhas been deprecated and replaced byHttpException. -
Resolved issue where parameterized types on
@RestMethod-annotated method parameters of Spring beans. This is due to Spring relying on CGLIB for runtime-recompilation of beans that results in loss of parameterized-type information.In the following example, the
beansparameter would resolve as an unparameterizedList<Object>which would typically result in getting aList<ObjectMap>and subsequentClassCastExceptions.@RestMethod
public void doFoo(@Body List<MyBean> beans) {...}The fix involves resolving the original bean class for resolving parameterized type while leaving method invocation on the proxy method so as not to bypass Spring features.
-
New methods on
BasicRestto provide feature-parity withRestServlet:BasicRestBasicRest.getContext() getContext()BasicRest.getRequest() getRequest()BasicRest.getResponse() getResponse()BasicRest.log(String) log(String)BasicRest.log(String,Throwable) log(String,Throwable)BasicRest.log(Level,String,Object[]) log(Level,String,Object[])BasicRest.logObjects(Level,String,Object[])BasicRest.log(Level,Throwable,String,Object[]) log(Level,Throwable,String,Object[]) -
The
@RestResource(staticFiles)annotation now supports absolute path locations and multiple mappings:// Resolves static files in root package "htdocs" or working directory "htdocs", and then relative package "htdocs".
@RestResource(staticFiles="htdocs:/htdocsfolder,htdocs:htdocs.package") -
Fixed a bug in
@RestResource(staticFiles)where the order of lookup between parent and child resources was wrong.
juneau-rest-client
-
Removed the dependency on the
juneau-rest-servermodule. Allows the client API to be used without pulling in all the javax.servlet and server dependencies. -
Support for Optional return types on remote proxy methods.
juneau-examples
- The PetStore application has been moved to a separate Git repository.
Release 8.1.0
Date: Aug 21, 2019
8.1.0 introduces some significant new features including:
Configurable AnnotationsDefault PojoSwapsConfig ImportsBasicRest,BasicRestGroupclassesPath variables on resource pathsRequest Attributes APIRole GuardsImproved REST logging/debugging- New MockRest API
juneau-marshall
-
New utility class for diffing beans:
BeanDiff -
New annotation for defining bean property names:
Name -
New serializer properties:
WriterSerializer WSERIALIZER_fileCharsetWSERIALIZER_streamCharset -
The following POJO methods can be used to convert a POJO to/from a Map before serialization and after parsing. It's a convenient way of defining a POJO transform.
- Can be any type of map with string keys and object vals.public Map<String,Object> toMap()public ObjectMap toMap() - Can be any type of map with string keys and object vals.public Map<String,Object> toMap(BeanSession bs)public ObjectMap toMap(BeanSession bs) - Can be any type of map with string keys and object vals.public static T fromMap(Map<String,Object> m)public static T fromMap(ObjectMap m) - Can be any type of map with string keys and object vals.public static T fromMap(BeanSession bs, Map<String,Object> m)public static T fromMap(BeanSession bs, ObjectMap m) -
New convenience debugging methods on Marshall API:
Marshall -oaj.marshall.Marshall.format(String,Object...) format(String,Object...)MessageFormat-style formatter. - Printsoaj.marshall.Marshall.out(String,Object...) out(String,Object...)MessageFormat-style messages to STDOUT. - Printsoaj.marshall.Marshall.err(String,Object...) err(String,Object...)MessageFormat-style messages to STDERR. -
Serializer and parser APIs now throw
IOExceptionsin addition toSerializeExceptionandParseExceptionto make it easier to determine if problems are stream based or syntax based. -
New Java 8 date-time transforms:
TemporalSwap- For all Java 8 temporal types (e.g. ZonedDateTime)TemporalDateSwap- For DateTemporalCalendarSwap- For Calendar
-
All serializers and parsers now have built-in default swaps for common class types:
Enumeration Iterator Locale Calendar - ISO offset date-time.Date - Local date-timeInstant - ISO instant.ZonedDateTime - ISO offset date-time.LocalDate - ISO local date.LocalDateTime - ISO local date-time.LocalTime - ISO local time.OffsetDateTime - ISO offset date-time.OffsetTime - ISO offset time.Year - ISO year.YearMonth - ISO year-month.Temporal - ISO instant.TimeZone XMLGregorianCalendar ZoneId
juneau-config
-
Support for import statements:
// Import values from another configuration:
<ParentConfig1>
[Foo]
bar = baz -
The
ConfigFileStorenow automatically resolves file extensions. New configuration property for specifying search paths for file extensions:FILESTORE_extensions -
Fixed a bug where instances of
ConfigMemoryStoreended up resolving to the same object. -
Uses
application.propertiesfile as a system default if present. Useful when being used in a Spring Boot application. -
New Config.setSystemProperties method for quickly moving configuration settings into the system properties.
-
Entries in the system config are automatically set as system properties. This means you can set any of the various serializer and parser settings (e.g.
JsonSerializer.simpleMode.b) in the default configuration area orapplication.properties.
juneau-rest-server
-
New annotations that can be applied to REST classes and methods to configure serializers and parsers.
Old way using generic properties:
@RestResource(
path="/atom",
title="Sample ATOM feed resource",
properties={
@Property(name=WSERIALIZER_quoteChar, value="'"),
@Property(name=RDF_rdfxml_tab, value="5"),
@Property(name=RDF_addRootProperty, value="true"),
@Property(name=BEAN_examples, value="{'org.apache.juneau.dto.atom.Feed': $F{AtomFeedResource_example.json}}")
}
...
)
public class AtomFeedResource extends BasicRestServletJena {
...
}New way using specific annotations:
@RestResource(
path="/atom",
title="Sample ATOM feed resource"
...
)
@SerializerConfig(quoteChar="'")
@RdfConfig(rdfxml_tab="5", addRootProperty="true")
@BeanConfig(examples="Feed: $F{AtomFeedResource_example.json}")
public class AtomFeedResource extends BasicRestServletJena {
...
}Config annotations are provided for all serializers and parsers:
BeanConfig CsvConfig HtmlConfig HtmlDocConfig JsoConfigJsonConfig JsonSchemaConfig MsgPackConfig OpenApiConfig ParserConfig PlainTextConfig RdfConfigSerializerConfig SoapXmlConfig UonConfig UrlEncodingConfig XmlConfig -
New support for using Servlet request attributes:
RequestAttributesRestContext REST_attrsRestContext.Builder attrs(String...)attr(String,Object)RestMethodContextRestMethodContext.RESTMETHOD_attrs RESTMETHOD_attrsRestRequest getAttributes() RestResponse getAttributes() RestResponse.attr(String,Object) attr(String,Object)Attr RestMethod.attrs()RestResource.attrs()This deprecates the following APIs:
RequestPropertiesRestMethodPropertiesRestRequest RestRequest.getProperties() getProperties()RestRequest.prop(String,Object) prop(String,Object) -
Added the following classes that provide the same support as the servlet classes but doesn't extend from
HttpServlet. This fixes an issue where instances ofBasicRestServletare registered as top-level servlets even though you don't want them to be. - Non-servlet equivalent toBasicRestBasicRestServlet - Non-servlet equivalent toBasicRestGroupBasicRestServletGroup - Non-servlet equivalent toBasicRestJenaBasicRestServletJena - Non-servlet equivalent toBasicRestJenaGroupBasicRestServletJenaGroup -
HTML widgets now have access to the
RestResponseobject if they need access to the output bean. -
New annotations for simplified role-based guards on classes and methods:
RestResourceroleGuard()rolesDeclared()RestMethodRestMethod.roleGuard roleGuard()RestMethod.rolesDeclared rolesDeclared() -
New annotations for fine-tuned handling of http-methods/http-headers as query parameters and others:
RestResourceallowedHeaderParams()allowedMethodHeaders()allowedMethodParams() -
The
@RestResource(path)annotation can now use variables:@RestResource(
path="/myResource/{foo}/{bar}"
)
public class MyResource extends BasicRestServlet {...} -
New methods:
RestRequest getCharset() RestResponse getCharset() -
New interface method for catching arbitrary thrown objects and converting them to other throwables:
RestCallHandlerRestCallHandler.convertThrowable(Throwable) convertThrowable(Throwable)BasicRestCallHandlerconvertThrowable(Throwable) -
Support for fine-tuned logging of HTTP requests and responses:
@RestResource(
debug="per-request",
logging=@Logging(
level="info",
rules={
@LoggingRule(codes="400-499", level="warning", req="short", res="short"),
@LoggingRule(codes="500-", level="severe", req="long", res="long")
}
)
)
public class MyRest {
@RestMethod(
method="POST",
path="foo",
logging=@Logging(
level="info",
rules={
@LoggingRule(exceptions="NotFound*", level="info"),
@LoggingRule(codes="200", disabled="true")
}
)
)
public String myMethod() throws Exception {...}
}See
RestLoggingAndDebuggingfor details. -
Fixed a bug where the HTTP response was returning 405 (method not found) but should really be 404 (not found) when no path patterns match on any of the Java methods.
juneau-rest-client
- PATCH support added.
Release 8.0.0
Date: Jan 01, 2019
This release cleans up deprecated APIs from the 7.2.0 release and makes significant modifications to the Microservice APIs.
The project structures of the REST, Microservice, and Examples have been modified to fit new Spring Boot integration support.
The structure is now as follows:
juneau-restjuneau-rest-clientjuneau-rest-serverjuneau-rest-server-jaxrsjuneau-rest-server-rdfjuneau-rest-server-springboot- New Spring Boot integration support classes.
juneau-microservicejuneau-microservice-core- New. Contains base Microservice class.juneau-microservice-jetty- New. Contains new JettyMicroservice class.juneau-my-jetty-microservice- New. Template starter project for Jetty-based microservices.juneau-my-springboot-microservice- New. Template starter project for Spring-Boot-based microservices.
juneau-examplesjuneau-corejuneau-microservice-rest- Now contains only servlet example classes. No Jetty configuration.juneau-microservice-rest-jetty- Servlet examples deployed using Jetty.juneau-microservice-rest-springboot- Servlet examples deployed using Spring Boot.
juneau-svl
-
New SVL variables:
SubstringVar PatternExtractVar PatternReplaceVar LenVar
juneau-config
-
New methods for setting a system default configuration:
Config getSystemDefault() setSystemDefault(Config) -
New classpath store:
ConfigClasspathStore -
New API method:
ConfigStore exists(String)
juneau-rest-server
-
New methods on
RestServlet:RestServlet.setRestResourceResolver(RestResourceResolver)RestServlet.getPath() -
The registered resource resolver is now used to instantiate objects of classes defined via
@RestResource. This allows for any of those instances to be injectable beans.
juneau-rest-server-springboot
- New project containing classes for making it easy to use Juneau with Spring Boot.
juneau-microservice-core
-
New project that consists of just the core Microservice class and console support.
-
The Microservice API has been revamped to use a builder-based approach to creating microservices. The new API is considerably more flexible in design and allows for the configuration and external files to be located in either the home directory or inside the jar classpath.
-
If the microservice cannot find a config file in the home directory with the same name as the jar and the
juneau.configFilesystem property is not found, it will try to find any file in the home directory that ends with.cfg. -
New MicroserviceListener API for defining lifecycle event listeners.
-
New ConfigCommand class for performing config queries and updates through the microservice console.
juneau-microservice-jetty
- New JettyMicroservice class replaces the previous
RestMicroservice.
juneau-my-jetty-microservice
- New template starter project for Jetty-based microservices.
juneau-my-springboot-microservice
- Template starter project for Spring-Boot-based microservices.
app.jsonandProcfilefiles for deploying examples into Heroku. Includes instructions.