problem description
A novice has just started webservice, of java. I want to create a restful-style webservice based on maven (data transfer format is json).
however, most of the data on the network is integrated with spring or webservcie created by frameworks such as cxf. What should I do if I don"t use cxf or other frameworks?
in other words: can I directly build a webservice JAX-RS project, then directly write the code, deploy and release it to run on tomcat? Is there a more detailed example of
? Thank you very much!
the environmental background of the problems and what methods you have tried
I have now written a restful-style class TestReast, but how should I publish it?
@Path("/testRest")
public class TestReast {
@GET
@Produces("application/json")
@Path("login")
public String login(@QueryParam("name")String name,@QueryParam("password")String password){
return "say"+name+password;
}
@POST
@Produces("application/json")
@Path("login2")
public String login2(@FormParam("name")String name,@FormParam("password")String password){
return "name:"+name+",password:"+password;
}
}
related codes
/ / Please paste the code text below (do not replace the code with pictures)