I have a class like this:
class Customer {
private int id;
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
}
and I have a glass fish web service:
i want to know it is possible to send a customer object using get
(i know i can do this in post, but in get ... i don't know)
this is what i tried:
@GET
@Path("/test")
@Produces(MediaType.TEXT_PLAIN)
@Consumes(MediaType.APPLICATION_OCTET_STREAM)
public String test(@QueryParam("customer") Customer customer) {
return "Done " + customer.getId();
}
then i call it like this:
..../test?id=4&name=william
I know that is wrong, but i don't know the correct way, and i don't know if that is even possible using get
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…