Package ratpack.core.render
Interface Renderable
-
- All Known Implementing Classes:
Markup,ResponseChunks,ServerSentEvents
public interface RenderableA renderable object, that can be given toContext.render(Object).A
Rendererfor this type is provided by Ratpack core, that simply delegates torender(Context). An alternative to providing aRendererimplementation for a type is to make the type implement this interface.import ratpack.core.handling.Context; import ratpack.core.render.Renderable; import ratpack.test.embed.EmbeddedApp; import static org.junit.jupiter.api.Assertions.*; public class Example { static class Thing implements Renderable { public void render(Context context) { context.render("thing!"); } } static void main(String... args) throws Exception { EmbeddedApp.fromHandler(ctx -> ctx.render(new Thing()) ).test(httpClient -> assertEquals("thing!", httpClient.getText()) ); } }An alternative to making a type implement this interface, is implementing a
Rendererfor it.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidrender(Context context)Render this object to the response.
-