summaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/eu/mulk/mulkcms2/benki/posts/PostResource.java50
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);
- }
}