Example #1
0
 // --
 @SuppressWarnings(value = "unchecked")
 private static Result invokeHandler(
     play.api.mvc.Handler handler, FakeRequest fakeRequest, long timeout) {
   if (handler instanceof play.core.j.JavaAction) {
     play.api.mvc.Action action = (play.api.mvc.Action) handler;
     return wrapScalaResult(action.apply(fakeRequest.getWrappedRequest()), timeout);
   } else {
     throw new RuntimeException("This is not a JavaAction and can't be invoked this way.");
   }
 }
Example #2
0
 // --
 @SuppressWarnings(value = "unchecked")
 private static Result invokeHandler(
     play.api.mvc.Handler handler, Request requestBuilder, long timeout) {
   if (handler instanceof play.api.mvc.Action) {
     play.api.mvc.Action action = (play.api.mvc.Action) handler;
     return wrapScalaResult(action.apply(requestBuilder._underlyingRequest()), timeout);
   } else if (handler instanceof JavaHandler) {
     return invokeHandler(
         ((JavaHandler) handler)
             .withComponents(
                 Play.application().injector().instanceOf(JavaHandlerComponents.class)),
         requestBuilder,
         timeout);
   } else {
     throw new RuntimeException("This is not a JavaAction and can't be invoked this way.");
   }
 }