Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rmohr/jetty-maven-cdi-demo
Demo application on how to setup and use resteasy, swagger, weld, jsr-303 and jetty together
https://github.com/rmohr/jetty-maven-cdi-demo
Last synced: 14 days ago
JSON representation
Demo application on how to setup and use resteasy, swagger, weld, jsr-303 and jetty together
- Host: GitHub
- URL: https://github.com/rmohr/jetty-maven-cdi-demo
- Owner: rmohr
- License: apache-2.0
- Created: 2015-10-27T08:27:09.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2015-10-27T09:22:40.000Z (about 9 years ago)
- Last Synced: 2024-10-11T14:41:20.329Z (about 1 month ago)
- Language: Java
- Size: 152 KB
- Stars: 0
- Watchers: 3
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
jetty-maven-cdi demo
====================This small demo describes how to configure a project to get the following
features:* Dependency injection in jetty through weld
* Automatic resteasy resource scanning and dependency injection through weld
* JSR-303 validation in resteasy resources
* Swagger jax-rs scanning
* Swagger serving the rest documentation on an endpoint
* JAX-RS subresource handling with resteasy and swaggerTo run the application simply type
```
$ mvn jetty:run
```When the application is started, you can look up the swagger documentation on
or
. The most difficult part here is
to convince swagger to scan your resteasy resources. The documentation is not
that good on that part. You can find the scanner which is also the servlet
which provides the documentation
[here](../master/src/main/java/rmohr/examples/cdi/RestScanner.java).Visit multiple times to see the Greeter service in
action, which is injected in the root resource.Visit to see the injected Greeter service
invoked from the subresource.Run
```
$ curl -H "Accept: application/json" -H "Content-Type: application/json" -X POST \
-i -d '{"name":"test", "description":"testsettsddsfs", "tags":["a", "b"]}' \
http://localhost:8080/api/sub/dto
```to post a valid dto and run
```
$ curl -H "Accept: application/json" -H "Content-Type: application/json" -X POST \
-i -d '{"name":"test", "description":"", "tags":["a", "b"]}' \
http://localhost:8080/api/sub/dto
```to post an invalid dto, to see the JSR-303 validation in action.