Say I have a Dropwizard/Jersey resource defined like so:
// Pseudo-code
@Path("/fizz")
@Produces(MediaType.APPLICATION_JSON)
class FizzResource {
FizzDao fizzDao
@GET
List<Fizz> getFizzesByType(@PathParam("type") String type) {
// Do some stuff up here
return fizzDao.getFizzesByType(type)
}
@POST
Widget determineWidgetByFoobaz(@PathParam("foobaz") String foobaz) {
// Do some stuff
List<Fizz> fizzes = getFizzesByType(foobaz.type)
Widget w = new Widget(fizzes, true, blah)
// Do some more stuff
return w
}
}
What happens when I call one endpoint (getFizzesByType
) from inside another endpoint (determineWidgetByFoobaz
)?
Does the framework know to just make a Java method call? Or is an actual network call (to localhost/loopback/etc.) made? If a network call is made, does the framework provide any way to configure it so that just a local Java method invocation is called instead?