Reputation: 179
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
Upvotes: 0
Views: 110
Reputation: 878
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!!!");
}
}
Upvotes: 0
Reputation: 1171
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")
Upvotes: 1