PostResource: Rearrange methods.
Change-Id: I1066712c9230688e672a84fc2cfe03e91f88e3a1
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 @@
}
@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 @@
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);
- }
}