1

我是阔叶新手。我想创建一个自定义 customerEndPoint 类,它将提供诸如注册客户获取客户详细信息等服务。我尝试在 com.mycompany.api.endpoint.customer 包中创建一个 CustomerEndpoint 类。是否有任何其他配置可以访问客户网址?

请帮忙解决这个...

4

2 回答 2

1

我解决了这个问题,分享它,因为它可能对某人有帮助。我在 applicationContent-rest-api.xml 中配置了 CustomerEndPoint bean,并将 CustomerEndpoint 注释为控制器并扩展了 BaseEndPoint。

客户端点.java

@Controller
@Scope("singleton")
@Path("/customer/")
@Produces(value = { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Consumes(value = { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public class CustomerEndpoint extends BaseEndpoint {
@Resource(name = "blCustomerService")
protected CustomerService customerService;

public void setCustomerService(CustomerService customerService) {
    this.customerService = customerService;
}

@GET
public CustomerWrapper getCustomer(@Context HttpServletRequest request,
        @QueryParam("id") String emailId) {
    CustomerWrapper customerWrapper = new CustomerWrapper();
    if (emailId != null && emailId != "") {
        customerWrapper.wrapDetails(
                customerService.readCustomerByEmail(emailId), request);
    }
    return customerWrapper;
}

}

applicationContext-rest-api.xml

<bean id="customerEndpoint" class="com.mycompany.api.endpoint.customer.CustomerEndpoint"/>
于 2014-07-10T10:37:40.793 回答
0

这取决于您使用的任何版本。如果您使用例如:broadleaf-3.1.X 请参阅 http://mvnrepository.com/artifact/org.broadleafcommerce/broadleaf-framework/3.1.5-GA

你可以举个例子com.mycompany.api.endpoint.checkout.CheckoutEndpoint

进入默认平台,org.broadleafcommerce.core.web.api.endpoint.customer.CustomerEndpoint但此实现为空。

您可以扩展该类并添加类似于com.mycompany.api.endpoint.checkout.CheckoutEndpoint根据您的需要添加业务逻辑的注释。

据我所知,平台中没有一些平台默认实现 int broadleaf-3.1.6-GA

于 2014-07-09T16:48:26.077 回答