@GET
 @Path("{year : 20[0-9]{2}}")
 public List<Post> getPostByYear(@PathParam("year") String y) {
   return ps.listPublishedPosts()
       .stream()
       .filter(p -> year.format(p.getPublishedDate()).equals(y))
       .collect(toList());
 }
 @GET
 @Path("{year : 20[0-9]{2}}/{month : (?:0[1-9]|1[0-2])}")
 public List<Post> getPostByYearMonth(@PathParam("year") String y, @PathParam("month") String m) {
   return ps.listPublishedPosts()
       .stream()
       .filter(p -> year.format(p.getPublishedDate()).equals(y))
       .filter(p -> month.format(p.getPublishedDate()).equals(m))
       .collect(toList());
 }
 @GET
 @Path("{year : 20[0-9]{2}}/{month : (?:0[1-9]|1[0-2])}/{permalink}")
 public Post getPost(
     @PathParam("year") String y,
     @PathParam("month") String m,
     @PathParam("permalink") String permalink) {
   List<Post> results =
       ps.listPublishedPosts()
           .stream()
           .filter(p -> p.getPermalink().equals(permalink))
           .filter(p -> year.format(p.getPublishedDate()).equals(y))
           .filter(p -> month.format(p.getPublishedDate()).equals(m))
           .collect(toList());
   if (results.isEmpty()) {
     return null;
   }
   return results.get(0);
 }
 @GET
 @Path("tagged/{tag}")
 public List<Post> getRelatedPosts(@PathParam("tag") String tag) {
   return ps.listPublishedPostsWithTagName(tag);
 }
 @GET
 @Path("id-{id : \\d+}/related")
 public List<Post> getRelatedPosts(
     @PathParam("id") Long id, @DefaultValue("0") @QueryParam("limit") int limit) {
   return ps.listRelatedPostsFor(id, limit);
 }
 @GET
 public List<Post> getPublishedPosts() {
   return ps.listPublishedPosts();
 }