endpoint with mergeCart
Posted: Wed Jun 12, 2013 1:17 pm
My setup:
I'm trying to access my own endpoint through a local service that I'm calling.
Upon logging on the site i'm working with, i kick off a process which makes a call out to my local service util.
LoginAction
calls-> EcommerceLocalServiceUtil.mergeCart(String email)
calls-> broadleaf rest services which we created: ...mergeCart with the encodedEmail
i know email is coming through:
However, i'm either having issues with the context, or the webrequest..
Has anyone worked with the mergeCartProcessor in this way (through an endpoint) and How should i continue when it seems I only have HttpServletRequest?
I'm trying to access my own endpoint through a local service that I'm calling.
Upon logging on the site i'm working with, i kick off a process which makes a call out to my local service util.
LoginAction
calls-> EcommerceLocalServiceUtil.mergeCart(String email)
calls-> broadleaf rest services which we created: ...mergeCart with the encodedEmail
Code: Select all
@Path("cart/{email}/mergeCart")
public void mergeCart(@Context HttpServletRequest request, @PathParam("email") String encodedEmail) {
BroadleafRequestContext context = BroadleafRequestContext.getBroadleafRequestContext();
context.setRequest(request);
if (email != null) {
Customer customer = customerService.readCustomerByEmail(email);
//I have tried all three Authentications below and always returns null.
//Authentication authResult = loginService.loginCustomer(customer);
UsernamePasswordAuthenticationToken authResult =
new UsernamePasswordAuthenticationToken(customer.getEmailAddress(),
customer.getPassword());
//Authentication authResult = SecurityContextHolder.getContext().getAuthentication();
mergeCartProcessor.execute(context.getWebRequest(), authResult);
//also the context.getWebRequest() doesn't work either, I get a classCastException.
}
i know email is coming through:
Code: Select all
18:08:24,607 INFO [http-bio-8080-exec-9][EcommerceLocalServiceImpl:485] mergeCart: REST URL: http://localhost:8080/broadleaf-portlet/api/intelligus/catalog/cart/test%40liferay.com/mergeCart
IntelligusCatalogEndpoint.mergeCart(test@liferay.com) -->
However, i'm either having issues with the context, or the webrequest..
Has anyone worked with the mergeCartProcessor in this way (through an endpoint) and How should i continue when it seems I only have HttpServletRequest?