PageRenderTime 92ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/src/com/bosv/controller/Blog.java

https://bitbucket.org/eagleon/restcoffee
Java | 55 lines | 27 code | 14 blank | 14 comment | 0 complexity | 8388f2b3895a446dab1da1facbdf8c4a MD5 | raw file
  1. /**
  2. * 文 件 名: Blog.java<br/>
  3. * 开发人员: @author Left<br/>
  4. * 邮 箱: <br/>
  5. * 系统名称: <br/>
  6. * 功能说明: <br/>
  7. * 开发时间: 2013-1-27上午1:41:21<br/>
  8. * 系统版本: @version 0.01<br/>
  9. * 版权信息: Copyright ? 2012-2013,bosv, All Rights Reserved<br/>
  10. * 修改记录: [M+修改顺序号 修改时间 修改人员 修改原因]<br/>
  11. *
  12. *
  13. */
  14. package com.bosv.controller;
  15. import java.util.HashMap;
  16. import org.apache.commons.logging.Log;
  17. import org.apache.commons.logging.LogFactory;
  18. import com.alibaba.fastjson.JSON;
  19. import com.bosv.web.Mapping;
  20. import com.bosv.web.renderer.Renderer;
  21. import com.bosv.web.renderer.TemplateRenderer;
  22. public class Blog {
  23. private final Log log = LogFactory.getLog(getClass());
  24. @Mapping("/hello")
  25. public String hello(){
  26. log.info("in hello");
  27. HashMap<String, String> hm = new HashMap<String, String>();
  28. hm.put("user", "left");
  29. hm.put("password", "12345");
  30. return JSON.toJSONString(hm);
  31. //return "<h1>hello,world!</h1>";
  32. }
  33. @Mapping("/hello/create/$1")
  34. public String hello(String name) {
  35. return "<h1>Hello, " + name + "</h1>";
  36. }
  37. @Mapping("/hello/show")
  38. public Renderer show(){
  39. return new TemplateRenderer("/jsp/index.jsp");
  40. }
  41. }