This is a repository for the Udemy tutorial Getting started with Dropwizard.
mvn package
Starting the application with run.sh
./run.sh
-
Navigate to localhost:8080/hello
-
curl -w "\n" localhost:8080/hello
-
Navigate to localhost:8080/hello/secured
-
curl -w "\n" localhost:8080/hello/secured -i -u username:p@ssw0rd
-
In the Chrome Postman plugin, set the Basic Auth username as
username
and password asp@ssw0rd
, and make a GET request for localhost:8080/hello/secured -
Copy the base-64 encoded output for
username:p@ssw0rd
from https://www.base64encode.org:
dXNlcm5hbWU6cEBzc3cwcmQ=
-
In the Chrome Postman plugin, set the Authorization header as
BASIC dXNlcm5hbWU6cEBzc3cwcmQ=
and make a GET request for localhost:8080/hello/secured -
curl -w "\n" localhost:8080/hello/secured -i -H "Authorization: Basic dXNlcm5hbWU6cEBzc3cwcmQ="
-
curl -w "\n" localhost:8080/hello/secured -k -i -u username:p@ssw0rd
-
Copy the base-64 encoded output for
username:p@ssw0rd
from https://www.base64encode.org:
dXNlcm5hbWU6cEBzc3cwcmQ=
curl -w "\n" localhost:8080/hello/secured -k -i -H "Authorization: Basic dXNlcm5hbWU6cEBzc3cwcmQ="
Using cURL
to test BookmarksResource.java
curl -i -k -w "\n" -u udemy:p@ssw0rd http://localhost:8080/bookmarks
curl -i -k -w "\n" -u udemy:p@ssw0rd http://localhost:8080/bookmarks/1
curl -i -k -w "\n" -u udemy:p@ssw0rd http://localhost:8080/bookmarks -X POST -H "Content-Type: application/json" -d '{"name": "udemy", "url": "http://udemy.com", "description": "e-learning site"}'
curl -i -k -w "\n" -u udemy:p@ssw0rd http://localhost:8080/bookmarks/5 -X DELETE
curl -i -k -w "\n" -u udemy:p@ssw0rd http://localhost:8080/bookmarks -X DELETE
curl -i -k -w "\n" -u udemy:p@ssw0rd http://localhost:8080/bookmarks/5 -X PUT -H "Content-Type: application/json" -d '{"name": "udemy", "url": "http://udemy.com", "description": "e-learning site"}'