1. Make sure you have a working Java development environment. The Maven configuration of the boilerplate requires at least Java 11.
1. Make sure you have a working Java development environment. The Maven configuration of the boilerplate requires at least Java 11.
2. Compile by executing `./build.sh`.
2. Clone this repository and don't fork as your code would be visible to other candidates in case you choose to push your implementation to a public repository.
3. After successful compilation execute `./standalone/jetty/target/dist/bin/rest`. It launches a REST API and listens on port 8282.
3. Compile by executing `./build.sh`.
4. Test the API by fetching data from the status resource by executing `curl http://localhost:8282/status`.
4. After successful compilation execute `./standalone/jetty/target/dist/bin/rest`. It launches a REST API and listens on port 8282.
5. If any of the above fails you need to revisit your development environment or talk to [hannes@metasolutions.se](mailto:hannes@metasolutions.se) (it may be a bug).
5. Test the API by fetching data from the status resource by executing `curl http://localhost:8282/status`.
6. If any of the above fails you need to revisit your development environment or talk to [hannes@metasolutions.se](mailto:hannes@metasolutions.se) (it may be a bug).
## Boilerplate
## Boilerplate
@ -19,7 +20,7 @@ Implementing a new resource involves creating a new class (see `StatusResource.j
## Exercise
## Exercise
1. Implement a new resource `/echo` that responds with the request body when posting (HTTP POST) to it; it should simply mirror the request back as response.
1. Implement a new resource `/echo` that responds with the request body when posting (HTTP POST) to it; it should simply mirror the request back as response.
2. Add content negotation to the echo resource and convert the payload: if the request is made with MIME type `text/csv` (i.e., `Content-Type: text/csv`), and the response is expected to be delivered in `text/html` (i.e., `Accept: text/html`), then convert from CSV to a simple HTML table. Very basic handling of the CSV payload (use the snippet from the next section) is sufficient, you don't need to use third party libraries to handle advanced CSVs with apostrophes, line breaks, etc..
2. Add content negotiation to the echo resource and convert the payload: if the request is made with MIME type `text/csv` (i.e., `Content-Type: text/csv`), and the response is expected to be delivered in `text/html` (i.e., `Accept: text/html`), then convert from CSV to a simple HTML table. Very basic handling of the CSV payload (use the snippet from the next section) is sufficient, you don't need to use third party libraries to handle advanced CSVs with apostrophes, line breaks, etc..