This example demonstrates the usage of Java 8's new constructs and types.

Currently demonstrated are:

  • Default methods in interfaces - acting as JAX-RS Resource Methods

Contents

The mapping of the URI path space is presented in the following table:

URI path Resource class HTTP method description
/j8/default-method DefaultMethodInterface GET returns interface-root in text/plain
/j8/default-method/path DefaultMethodInterface GET returns interface-path in text/plain
/j8/default-method/class DefaultMethodResource GET returns class in text/plain
/j8/lambdas/{p} LambdaResource GET returns {p}-lambdaized in text/plain

Application is Servlet 3 based, web.xml-less. Everything needed (resources/providers) is registered in the Java8Application class.

Running the Example

Run the example as follows:

mvn clean package jetty:run

This deploys current example using Jetty. You can access the application at: