Skip to content

iancampbellstuff/DropBookmarks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

64 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DropBookmarks


This is a repository for the Udemy tutorial Getting started with Dropwizard.

Required dependencies

Building the application
mvn package
Starting the application with run.sh
./run.sh

Making ReST requests
HTTP
  1. Navigate to localhost:8080/hello

  2. curl -w "\n" localhost:8080/hello

  3. Navigate to localhost:8080/hello/secured

  4. curl -w "\n" localhost:8080/hello/secured -i -u username:p@ssw0rd

  5. In the Chrome Postman plugin, set the Basic Auth username as username and password as p@ssw0rd, and make a GET request for localhost:8080/hello/secured

  6. 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="

HTTPS
  1. curl -w "\n" localhost:8080/hello/secured -k -i -u username:p@ssw0rd

  2. 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
GET
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
POST
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"}'
DELETE
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
PUT
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"}'

About

This is a repository for the Udemy tutorial on Dropwizard found at https://www.udemy.com/getting-started-with-dropwizard .

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages