Skip to content

Commit 41a0321

Browse files
committed
small note about JAX-RS annotations
1 parent 023334b commit 41a0321

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

docs/asciidoc/mvc-api.adoc

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,3 +371,46 @@ fun main(args: Array<String>) {
371371
----
372372

373373
{love}
374+
375+
=== JAX-RS Annotations
376+
377+
Alternative you can use JAX-RS annotations to define MVC routes.
378+
379+
.Resource
380+
[source, java, role="primary"]
381+
----
382+
383+
import javax.ws.rs.GET;
384+
import javax.ws.rs.Path;
385+
386+
@Path("/jaxrs")
387+
public class Resource {
388+
389+
@GET
390+
public String getIt() {
391+
return "Got it!";
392+
}
393+
}
394+
----
395+
396+
.Kotlin
397+
[source, kotlin, role="secondary"]
398+
----
399+
import javax.ws.rs.GET
400+
import javax.ws.rs.Path
401+
402+
@Path("/jaxrs")
403+
class Resource {
404+
405+
@GET
406+
fun getIt() : String {
407+
return "Got it!"
408+
}
409+
}
410+
----
411+
412+
Annotations work exactly like the Jooby MVC annotations, but keep in mind we don't implement the
413+
JAX-RS specification and there is no immediate plan to do it.
414+
415+
The main reason to support JAX-RS annotations is to let you plug-in third-party tools that rely
416+
on them (mostly annotations processors).

0 commit comments

Comments
 (0)