Skip to content
This repository was archived by the owner on Oct 4, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class BookmarkServlet(system: ActorSystem, bookmarkStore: ActorRef) extends Http
val uuidFuture = bookmarkStore ? AddBookmark(title, url)
uuidFuture.mapTo[Option[UUID]].onComplete {
case Success(uuid) ⇒
writer.write("Successfully created bookmark.")
writer.write(s"Successfully created bookmark with uuid=$uuid")
case Failure(error) ⇒
writer.write("Failure creating bookmark: " + error.getMessage)
}
Expand All @@ -40,7 +40,7 @@ class BookmarkServlet(system: ActorSystem, bookmarkStore: ActorRef) extends Http

val asyncCtx = req.startAsync()
val writer = asyncCtx.getResponse.getWriter
val bookmarkId = UUID.fromString(req.getParameter("id"))
val bookmarkId = UUID.fromString(req.getParameter("uuid"))

implicit val timeout = Timeout(5 seconds)
asyncCtx.setTimeout(5 * 1000)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ class BookmarkStore(database: Database[Bookmark, UUID]) extends Actor {
database.find(bookmark) match {
case Some(found) ⇒ sender ! None
case None ⇒
database.create(UUID.randomUUID, bookmark)
sender ! Some(bookmark)
val uuid = UUID.randomUUID
database.create(uuid, bookmark)
sender ! Some(uuid)
}
case GetBookmark(uuid) ⇒
sender ! database.read(uuid)
Expand Down