I am currently working with with web services for the first time and I have to write some examples of different web services in Jersey using Maven,
But I can only seem to get it to work in Spark (Here's My spark example)
//Hashmap Example
get("add/:num1/:num2", new Route() {
@Override
public Object handle(Request rqst, Response rspns) throws Exception {
rspns.type("application/json");
int num1 = Integer.parseInt(rqst.params(":num1"));
int num2 = Integer.parseInt(rqst.params(":num2"));
HashMap<String, Integer> map = new HashMap<>();
map.put("result", num1+num2);
Gson gson = new Gson();
return gson.toJson(map);
}
});
I just need some help writing it for a Jersey example ?
Any help you can offer would be great