Am trying to get request source ip with annotation @JsonProperty("IP") which not populating values.
Hi , I wrote web application using ResteasyBootstrap to receive and process http request with post parameters. ex: client send the product details in post parameters to server url. below is the sample
@Path("/json/Product")
public class Prodcut {
@POST
@Path("/post")
@Produces("application/json")
public Product getProductInJSON(Product product) {
System.out.println(product.toString());
String respMsg=processProduct(product);// process product
product.setResponseMessage(respMsg);
String JsonRespString=new Gson().toJson(product);
return Response.status(201).entity(JsonRespString).build();
}
public class Product{
@JsonProperty("name")
private String name;
@JsonProperty("msgid")
private String msgId;
/*setters gettes */
@Override
public String toString() {
return "{\"msgid=\":\"" + this.msgId + "\" , \"name\":\"" + this.name +""/
}"; }
now how do i get ip of client. Suggest me