我正在尝试使用Broadleaf来创建购物车、添加项目和在消费者应用程序上签出。克隆演示应用程序并按照链接:https://www.broadleafcommerce.com/docs/core/current/broadleaf-concepts/rest/rest-tutorials修改配置
问题: 1.创建新的购物车-> POST:http://localhost:8080/api/v1/cart异常: HttpRequestMethodNotSupportedException: Request 'POST‘不支持GET请求: worked
3.在订购邮件中添加付款:如上述URL异常:"com.broadleafcommerce.rest.api.exception.BroadleafWebServicesException.queryParameterNotPresent“”:"queryParameterNotPresent“、”消息“:OrderPaymentWrapper中提到的那样,http://localhost:8080/api/v1/cart/checkout/payment?customerId=100在正文中添加了OrderPaymentWrapper
或者,请https://demo.broadleafcommerce.org/api/v2/swagger-ui.html#/按照swagger文档调用API。相同的问题,无法创建订单流。
我试图通过在本地主机https://github.com/BroadleafCommerce/DemoSite上运行相同的问题来进行调试。
请给我建议。
发布于 2017-08-20 15:34:14
这看起来是我们的@FrameworkController注释中一个突出的问题。我在https://github.com/BroadleafCommerce/Issues/issues/3开了一期“阔叶树”杂志,更多地了解了为什么它现在失败了。
解决方法是修改API项目中的CustomCartEndpoint,您必须在createNewCartForCustomer()方法中添加该项目。CustomCartEndpoint的最终实现应该如下所示:
@RestController
@RequestMapping(value = "/cart",
            produces = { MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE })
public class CustomCartEndpoint extends CartEndpoint {
    @Override
    @RequestMapping(value = "", method = RequestMethod.GET)
    public OrderWrapper findCartForCustomer(HttpServletRequest request) {
        try {
            return super.findCartForCustomer(request);
        } catch (Exception e) {
            // if we failed to find the cart, create a new one
            return createNewCartForCustomer(request);
        }
    }
    @Override
    @RequestMapping(value = "", method = RequestMethod.POST)
    public OrderWrapper createNewCartForCustomer(HttpServletRequest request) {
        return super.createNewCartForCustomer(request);
    }
}https://stackoverflow.com/questions/45652009
复制相似问题