test RESt API
This commit is contained in:
parent
71ff5dcd2b
commit
ef637b1b85
@ -2,7 +2,7 @@ package de.hsadmin.rest.customer;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.ejb.EJB;
|
import javax.inject.Inject;
|
||||||
import javax.ws.rs.GET;
|
import javax.ws.rs.GET;
|
||||||
import javax.ws.rs.HeaderParam;
|
import javax.ws.rs.HeaderParam;
|
||||||
import javax.ws.rs.Path;
|
import javax.ws.rs.Path;
|
||||||
@ -10,30 +10,30 @@ import javax.ws.rs.PathParam;
|
|||||||
|
|
||||||
import de.hsadmin.common.error.TechnicalException;
|
import de.hsadmin.common.error.TechnicalException;
|
||||||
import de.hsadmin.common.error.UserException;
|
import de.hsadmin.common.error.UserException;
|
||||||
import de.hsadmin.login.LoginService;
|
import de.hsadmin.login.LoginServiceLocal;
|
||||||
import de.hsadmin.login.RequestContext;
|
import de.hsadmin.login.RequestContext;
|
||||||
import de.hsadmin.service.customer.ContactService;
|
import de.hsadmin.service.customer.ContactServiceLocal;
|
||||||
import de.hsadmin.service.customer.ContactVO;
|
import de.hsadmin.service.customer.ContactVO;
|
||||||
|
|
||||||
@Path("/contacts")
|
@Path("/contacts")
|
||||||
public class ContactsAPI {
|
public class ContactsAPI {
|
||||||
|
|
||||||
@EJB
|
@Inject
|
||||||
LoginService login;
|
LoginServiceLocal loginEJB;
|
||||||
|
|
||||||
@EJB
|
@Inject
|
||||||
ContactService ejb;
|
ContactServiceLocal contactEJB;
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("/{customer}")
|
@Path("/{customer}")
|
||||||
public List<ContactVO> getContactsByMember(@PathParam("customer") String customer, @HeaderParam("X-HS-Auth") String ticket) throws UserException, TechnicalException {
|
public List<ContactVO> getContactsByMember(@PathParam("customer") String customer, @HeaderParam("X-HS-Auth") String ticket) throws UserException, TechnicalException {
|
||||||
System.out.println("customer: " + customer);
|
System.out.println("customer: " + customer);
|
||||||
System.out.println("ticket: " + ticket);
|
System.out.println("ticket: " + ticket);
|
||||||
System.out.println("LoginService: " + login);
|
System.out.println("LoginService: " + loginEJB);
|
||||||
RequestContext context = login.createContext(ticket, null);
|
RequestContext context = loginEJB.createContext(ticket.trim(), "");
|
||||||
ContactVO vo = new ContactVO();
|
ContactVO vo = new ContactVO();
|
||||||
vo.setCustomer(customer);
|
vo.setCustomer(customer);
|
||||||
List<ContactVO> list = ejb.read(context, vo);
|
List<ContactVO> list = contactEJB.read(context, vo);
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user