@Test public void testAccessToContext() { EmptyController controller = new EmptyController(); Context context = mock(Context.class); Context.CONTEXT.set(context); assertThat(controller.context()).isSameAs(context); }
public Context context() { Context ctxt = Context.CONTEXT.get(); if (ctxt == null) { throw new IllegalStateException("No context set from " + Thread.currentThread().getName()); } return ctxt; }
DefaultController extends Results implements Status, HeaderNames, Controller { public Context context() { Context ctxt = Context.CONTEXT.get(); if (ctxt == null) { throw new IllegalStateException("No context set from " + Thread.currentThread().getName()); } return ctxt; } }
DefaultController extends Results implements Status, HeaderNames, Controller { public Context context() { Context ctxt = Context.CONTEXT.get(); if (ctxt == null) { throw new IllegalStateException("No context set from " + Thread.currentThread().getName()); } return ctxt; }  }
DefaultController extends Results implements Status, HeaderNames, Controller { public Context context() { Context ctxt = Context.CONTEXT.get(); if (ctxt == null) { throw new IllegalStateException("No context set from " + Thread.currentThread().getName()); } return ctxt; }  Logger logger(); Context context(); Request request(); SessionCookie session(); void session(String key, String value); String session(String key); FlashCookie flash(); void flash(String key, String value); String flash(String key); List<Route> routes(); Renderable<?> render(Template template, Map<String, Object> parameters); Renderable<?> render(Template template, Object... parameters); Renderable<?> render(Template template); }
DefaultController extends Results implements Status, HeaderNames, Controller { public Context context() { Context ctxt = Context.CONTEXT.get(); if (ctxt == null) { throw new IllegalStateException("No context set from " + Thread.currentThread().getName()); } return ctxt; }  Logger logger(); Context context(); Request request(); SessionCookie session(); void session(String key, String value); String session(String key); FlashCookie flash(); void flash(String key, String value); String flash(String key); List<Route> routes(); Renderable<?> render(Template template, Map<String, Object> parameters); Renderable<?> render(Template template, Object... parameters); Renderable<?> render(Template template);  }