JAX-RS is a specification that provides portable API’s for developing, exposing and accessing web applications designed and implemented in compliance with principals of REST architectural style.
JAX-RS has annotations to bind specific URI patterns and HTTP methods to individual methods of your Java code. AEM is driven based on REST principals but there is no direct support for creating Restful services.
There are multiple implementations for JAX-RS specifications, this tutorial explains exposing REST based services in AEM through Jersey.
Install JAX-RS Jersey modules
As a first step, install the JAX-RS Jersey connector to AEM server
The connector modules can be downloaded from the following URL — https://search.maven.org/search?q=g:com.eclipsesource.jaxrs, the required modules are jersey-all, publisher and provider-gson