@Path("/{company}") @GET @Produces(MediaType.APPLICATION_JSON) public Response getCompany(@PathParam("company") String company) { logger.info("get company"); return makeCORS(Response.ok(companyService.getCompany(company))); }
@POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response addCompany( @HeaderParam("Access-Control-Request-Headers") String requestH, Company company) { logger.info("add company " + company.getName()); companyService.addCompany(company); return makeCORS(Response.ok("added succesful company " + company.getName())); }
@Path("/all/{user}") @GET @Produces(MediaType.APPLICATION_JSON) public Response getCompaniesByUser(@PathParam("user") String user) { logger.info("get comapanies"); GenericEntity<List<Company>> entity = new GenericEntity<List<Company>>(companyService.getCompaniesByUser(user)) {}; return makeCORS(Response.ok(entity)); }
@Path("/all") @GET @Produces(MediaType.APPLICATION_JSON) public Response getCompanies() { logger.info("get comapanies"); GenericEntity<List<Company>> entity = new GenericEntity<List<Company>>(companyService.getCompanies()) {}; return makeCORS(Response.ok(entity)); }