Json api doc Controller例子

@Controller
@RequestMapping(value = "/jsondoc")
public class JSONDocController {
private final static Logger log = LoggerFactory.getLogger(JSONDocController.class);

@Autowired(required=false)
private ServletContext servletContext;

@RequestMapping(method = RequestMethod.GET, produces=MediaType.APPLICATION_JSON_VALUE)
public @ResponseBody
JSONDoc getApi(HttpServletRequest request) {
   String version = ApiConfig.getAppVersion();
   String basePath = StringUtils.join(
           new Object[]{request.getScheme()
                   , "://"
                   , request.getServerName()
                   , ":"
                   , request.getServerPort()
                   , request.getContextPath()
                   , "/"
                   });
   
   log.info("init doc version [{}], doc path [{}]", version, basePath);
   
return JSONDocUtils.getApiDoc(servletContext, version, basePath);
}
}

你可能感兴趣的:(webservice,文档生成,jsondoc,json文档)