From 3c4911e9a87702fcf199d410a5502775b02e9947 Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Sun, 19 Apr 2020 18:53:20 +0200 Subject: PostResource: Rearrange methods. Change-Id: I1066712c9230688e672a84fc2cfe03e91f88e3a1 --- .../eu/mulk/mulkcms2/benki/posts/PostResource.java | 50 +++++++++++----------- 1 file changed, 25 insertions(+), 25 deletions(-) (limited to 'src/main/java/eu') 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 @@ -177,6 +177,31 @@ public abstract class PostResource { return pageKey; } + @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) @@ -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); - } } -- cgit v1.2.3