PostResource.java 文件源码

java
阅读 44 收藏 0 点赞 0 评论 0

项目:splinter 作者:
@POST
@Path("/{id}/edit")
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
@Template(name= "/post/single")
public Response editPostAction(@PathParam("id") int id,
                               @FormParam("title")
                               @Pattern(regexp = "^(?!\\s*$).+", message = "empty string") String title,
                               @FormParam("content")
                               @Pattern(regexp = "^(?!\\s*$).+", message = "empty string") String content){
    Post post=Post.findById(id);
    post.setTitle(title);
    post.setContent(content);
    post.saveIt();
    URI targetURIForRedirection = URI.create(RESOURCE_PATH + post.getId());
    return Response.seeOther(targetURIForRedirection).build();
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号