diff options
author | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | 2020-02-13 05:00:54 +0100 |
---|---|---|
committer | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | 2020-02-13 05:00:54 +0100 |
commit | fc427e26493d4bd070c09e5dbc348a1355c00e38 (patch) | |
tree | df04f0b158373549c6cc333f0de834f3e2be9f80 /src/main/java/eu | |
parent | 6991257cd67631efae78e141b8ae7794129483c1 (diff) |
Add /bookmarks/new endpoint.
Change-Id: I903dbf5f918e1478fff82e5ebf6f3e3e2766572d
Diffstat (limited to 'src/main/java/eu')
-rw-r--r-- | src/main/java/eu/mulk/mulkcms2/benki/bookmarks/BookmarkResource.java | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/main/java/eu/mulk/mulkcms2/benki/bookmarks/BookmarkResource.java b/src/main/java/eu/mulk/mulkcms2/benki/bookmarks/BookmarkResource.java index a535d0d..00e2824 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/bookmarks/BookmarkResource.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/bookmarks/BookmarkResource.java @@ -21,6 +21,8 @@ import java.time.format.FormatStyle; import java.time.temporal.TemporalAccessor; import java.util.List; import java.util.Set; +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; import javax.inject.Inject; import javax.json.JsonObject; import javax.json.spi.JsonProvider; @@ -55,6 +57,10 @@ public class BookmarkResource { @Inject Template bookmarkList; + @ResourcePath("benki/bookmarks/newBookmark.html") + @Inject + Template newBookmark; + @Inject SecurityIdentity identity; @GET @@ -83,6 +89,17 @@ public class BookmarkResource { return bookmarkList.data("bookmarks", bookmarks).data("authenticated", !identity.isAnonymous()); } + @GET + @Authenticated + @Path("new") + @Produces(TEXT_HTML) + public TemplateInstance getNewBookmarkForm( + @QueryParam("uri") @CheckForNull String uri, + @QueryParam("title") @CheckForNull String title, + @QueryParam("description") @CheckForNull String description) { + return newBookmark.data("uri", uri).data("title", title).data("description", description); + } + @POST @Transactional @Authenticated |