// Root resource class
@Path("/employeeinfo")
public class EmployeeInfo {
// Subresource locator: obtains the subresource Employee
// from the path /employeeinfo/employees/{empid}
@Path("/employees/{empid}")
public Employee getEmployee(@PathParam("empid") String id) {
// Find the Employee based on the id path parameter
Employee emp = ...;
...
return emp;
}
}
// Subresource class
public class Employee {
// Subresource method: returns the employee's last name
@GET
@Path("/lastname")
public String getEmployeeLastName() {
...
return lastName;
}
}