日期:2014-05-16 浏览次数:20540 次
package com.example.rest.resteasy.model;
public class Customer {
	private int id;
	private String firstName;
	private String lastName;
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getFirstName() {
		return firstName;
	}
	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}
	public String getLastName() {
		return lastName;
	}
	public void setLastName(String lastName) {
		this.lastName = lastName;
	}
}
package com.example.rest.resteasy.service;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import com.example.rest.resteasy.model.Customer;
@Path("/hello")
public class HelloWorldRestService {
	@GET
	@Path("/customer/json")
	@Produces("application/json")
	public Customer getProductInJSON() {
		Customer customer = new Customer();
		customer.setFirstName("first");
		customer.setLastName("last");
		customer.setId(100);
		return customer;
	}
}
