Aşağıda bir kaynak ve alt kaynak olan bir örnek gösterilmektedir :
@Path("/helloworld")
public class HelloWorldResource {
@GET
@Produces("text/plain")
public String getClichedMessage() {
return "Hello World";
}
@GET
@Produces("text/plain")
@Path("/tr")
public String getClichedMessageTr() {
return "Merhaba Dunya";
}
}
Yukarıdaki örnekte HelloWorldResource bir kaynak (root resource) class'ıdır ve <root>/helloworld şeklinde GET ile erişildiğinde getClichedMessage çalışacaktır. getClichedMessageTr ise bir alt kaynağı gösterir ve bu alt kaynağa GET ile <root>/helloworld/tr şeklinde erişilebilir