I'm new with Jersey Rest Framework and I wrote an simple demo to learn this skill. Here is my problem: I tried to reach my helloworld with this URL---
http://localhost:8080/PayInterface/query/helloworld
but didn't work. Would you please tell me what I did wrong? I wrote a class:
@Component
//Declaring that all it will handle all requests starting by /TestCaseDto
@Path("query")
public class QueryApi {
@Path("/helloworld")
@GET
@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
public String test(){
return new String("Hello World!!!");
}
}
and I
A little more detail about this "dint work" would be nice
for starters- try changing your path above your class name like this
@Path("/query")
I think in here you return string. so you can't give produce type as xml ,Try this
@Stateless
@Path("query")
public class QueryApi {
@Path("/helloworld")
@GET
@Produces({MediaType.APPLICATION_JSON})
public String test(){
return new String("Hello World!!!");
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.