Java SpringController:Facebook上类似文章的永久链接

Java SpringController:Facebook上类似文章的永久链接,java,facebook,spring,controller,permalinks,Java,Facebook,Spring,Controller,Permalinks,我想将永久链接功能添加到我在春季编写的web中。 若用户点击永久链接底部的文章,Spring必须向用户浏览器页面发送只有一篇id为url的文章 例如: 这是我的密码: @Controller public class ArticleController { @Autowired private ArticleManager am; @RequestMapping(value = "/article/{id}", method = RequestMethod.GET)

我想将永久链接功能添加到我在春季编写的web中。 若用户点击永久链接底部的文章,Spring必须向用户浏览器页面发送只有一篇id为url的文章

例如:

这是我的密码:

@Controller
public class ArticleController {

    @Autowired
    private ArticleManager am;

    @RequestMapping(value = "/article/{id}", method = RequestMethod.GET)
    public String showArticle(@PathVariable int id, Model model,
            final RedirectAttributes redirectAttributes) {

        String visited = "no";
        try {
            visited = (String) model.asMap().get("visited");
        } catch (Exception e) {
            e.printStackTrace();
        }        

        if (! visited.equals("yes")) {
            Article x = am.findById(id);
            model.addAttribute("article", x);
            redirectAttributes.addAttribute("visited", "yes");          
            return "/article/"+id;          
        }       

        return "redirect:/article/"+id;        
    }
}
更新:
就像在Facebook的墙上。如果我点击文章底部的发布日期,Facebook会将我重定向到只有这篇文章的页面:

你能澄清一下,如果用户点击永久链接底部文章,Spring必须发送到用户浏览器页面,就像Facebook墙上的一样。如果我点击帖子底部的发布日期,Facebook会将我重定向到只包含此帖子的页面: