diff options
author | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | 2020-04-19 18:53:20 +0200 |
---|---|---|
committer | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | 2020-04-19 18:53:20 +0200 |
commit | 3c4911e9a87702fcf199d410a5502775b02e9947 (patch) | |
tree | c4ffd10cf0c3ab1d5ec3995e92c3b464dc923879 /src/main/java | |
parent | c5b99755e529bb3e5de04584115598e81a23eeb9 (diff) |
PostResource: Rearrange methods.
Change-Id: I1066712c9230688e672a84fc2cfe03e91f88e3a1
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/eu/mulk/mulkcms2/benki/posts/PostResource.java | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/src/main/java/eu/mulk/mulkcms2/benki/posts/PostResource.java b/src/main/java/eu/mulk/mulkcms2/benki/posts/PostResource.java index 2e67208..5f3c8b4 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/posts/PostResource.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/posts/PostResource.java @@ -178,6 +178,31 @@ public abstract class PostResource { } @GET + @Produces(APPLICATION_JSON) + @Path("{id}") + public Post getPostJson(@PathParam("id") int id) { + return getPostIfVisible(id); + } + + @GET + @Produces(TEXT_HTML) + @Path("{id}") + public TemplateInstance getPostHtml(@PathParam("id") int id) { + var post = getPostIfVisible(id); + + return postList + .data("posts", List.of(post)) + .data("pageTitle", pageTitle) + .data("showBookmarkForm", false) + .data("showLazychatForm", false) + .data("hasPreviousPage", false) + .data("hasNextPage", false) + .data("previousCursor", null) + .data("nextCursor", null) + .data("pageSize", null); + } + + @GET @Path("feed") @Produces(APPLICATION_ATOM_XML) public String getFeed(@QueryParam("page-key") @CheckForNull String pageKeyBase36) @@ -376,29 +401,4 @@ public abstract class PostResource { protected final User getCurrentUser() { return identity.isAnonymous() ? null : User.findByNickname(identity.getPrincipal().getName()); } - - @GET - @Produces(APPLICATION_JSON) - @Path("{id}") - public Post getPostJson(@PathParam("id") int id) { - return getPostIfVisible(id); - } - - @GET - @Produces(TEXT_HTML) - @Path("{id}") - public TemplateInstance getPostHtml(@PathParam("id") int id) { - var post = getPostIfVisible(id); - - return postList - .data("posts", List.of(post)) - .data("pageTitle", pageTitle) - .data("showBookmarkForm", false) - .data("showLazychatForm", false) - .data("hasPreviousPage", false) - .data("hasNextPage", false) - .data("previousCursor", null) - .data("nextCursor", null) - .data("pageSize", null); - } } |