Broadleaf电商系统开发(五) - Http Api

Broadleaf默认已经提供了http api的controller,只需要enable就可以了。
需要修改site /src/main/webapp/WEB-INF/applicationContext-servlet.xml,添加
             <context:component-scan base-package="com.mycompany.api" />
然后启动demoSite项目。

访问方式
    方法一:  wget --header="Content-Type: application/json"  http://172.31.93.150:8080/catalog/product/5
    方法二: 使用firefox浏览器访问 http://172.31.93.150:8080/catalog/product/5,编辑header,添加 Content-Type: application/json,然后执行resend,在response tab页查看返回的结构

你可能感兴趣的:(api,电商,broadleaf)