@Test public void testGetEmployee(){ Response response = target("employee").path("1").request().accept(MediaType.APPLICATION_XML).get(); System.out.println(response.getStatus()); System.out.println(response.readEntity(String.class)); }
@Path("{id}") @GET public Employee getEmployee(@PathParam("id")int id){ Department department = new Department(id,"研发部"); Employee employee = new Employee(id,"scott",department); return employee; }
EmployeeRestService { @Path("{id}") @GET public Employee getEmployee(@PathParam("id")int id){ Department department = new Department(id,"研发部"); Employee employee = new Employee(id,"scott",department); return employee; } }
EmployeeRestService { @Path("{id}") @GET public Employee getEmployee(@PathParam("id")int id){ Department department = new Department(id,"研发部"); Employee employee = new Employee(id,"scott",department); return employee; }  }
EmployeeRestService { @Path("{id}") @GET public Employee getEmployee(@PathParam("id")int id){ Department department = new Department(id,"研发部"); Employee employee = new Employee(id,"scott",department); return employee; }  @Path("/v1") @GET List<Employee> getEmployees(); @Path("{id}") @GET Employee getEmployee(@PathParam("id")int id); @POST Employee saveEmployee(Employee employee); @PUT Employee updateEmployee(Employee employee); @DELETE @Path("{id}") Employee deleteEmployee(@PathParam("id")int id); }
EmployeeRestService { @Path("{id}") @GET public Employee getEmployee(@PathParam("id")int id){ Department department = new Department(id,"研发部"); Employee employee = new Employee(id,"scott",department); return employee; }  @Path("/v1") @GET List<Employee> getEmployees(); @Path("{id}") @GET Employee getEmployee(@PathParam("id")int id); @POST Employee saveEmployee(Employee employee); @PUT Employee updateEmployee(Employee employee); @DELETE @Path("{id}") Employee deleteEmployee(@PathParam("id")int id);  }