@Override public CompletionStage<Result> call(Http.Request req) { return delegate.call(req); } };
@Override public CompletionStage<Result> call(Http.Request req) { return delegate.call(req); } };
@Override public F.Promise<Result> call(Http.Context ctx) throws Throwable { return delegate.call(ctx); } };
@Override public CompletionStage<Result> call(Http.Request req) { return delegate.call(req); } };
public F.Promise<Result> call(Context ctx) throws Throwable { return delegate.call(ctx); } };
public CompletionStage<Result> call(final Request req) { Authenticator authenticator = configurator.apply(configuration); return authenticator.getUsername(req) .map(username -> delegate.call(req.addAttr(USERNAME, username))) .orElseGet(() -> CompletableFuture.completedFuture(authenticator.onUnauthorized(req))); }
public CompletionStage<Result> call(final Request req) { Authenticator authenticator = configurator.apply(configuration); return authenticator.getUsername(req) .map(username -> delegate.call(req.addAttr(USERNAME, username))) .orElseGet(() -> CompletableFuture.completedFuture(authenticator.onUnauthorized(req))); }
public CompletionStage<Result> call(final Request req) { Authenticator authenticator = configurator.apply(configuration); return authenticator.getUsername(req) .map(username -> delegate.call(req.addAttr(USERNAME, username))) .orElseGet(() -> CompletableFuture.completedFuture(authenticator.onUnauthorized(req))); }
/** * Executes this action with the given HTTP context and returns the result. * * @param ctx the http context in which to execute this action * @return a promise to the action's result * * @deprecated Since 2.7.0. Use {@link #call(Request)} instead. Please see <a href="https://www.playframework.com/documentation/latest/JavaHttpContextMigration27">the migration guide</a> for more details. */ @Deprecated // TODO: When you remove this method make call(Request) below abstract public CompletionStage<Result> call(Context ctx) { return call(ctx.args != null && !ctx.args.isEmpty() ? ctx.request().addAttr(CTX_ARGS, ctx.args) : ctx.request()); }
/** * Executes this action with the given HTTP context and returns the result. * * @param ctx the http context in which to execute this action * @return a promise to the action's result * * @deprecated Since 2.7.0. Use {@link #call(Request)} instead. Please see <a href="https://www.playframework.com/documentation/latest/JavaHttpContextMigration27">the migration guide</a> for more details. */ @Deprecated // TODO: When you remove this method make call(Request) below abstract public CompletionStage<Result> call(Context ctx) { return call(ctx.args != null && !ctx.args.isEmpty() ? ctx.request().addAttr(CTX_ARGS, ctx.args) : ctx.request()); }
/** * Executes this action with the given HTTP context and returns the result. * * @param ctx the http context in which to execute this action * @return a promise to the action's result * * @deprecated Since 2.7.0. Use {@link #call(Request)} instead. Please see <a href="https://www.playframework.com/documentation/latest/JavaHttpContextMigration27">the migration guide</a> for more details. */ @Deprecated // TODO: When you remove this method make call(Request) below abstract public CompletionStage<Result> call(Context ctx) { return call(ctx.args != null && !ctx.args.isEmpty() ? ctx.request().addAttr(CTX_ARGS, ctx.args) : ctx.request()); }
/** * Executes this action with the given HTTP request and returns the result. * * @param req the http request with which to execute this action * @return a promise to the action's result */ public CompletionStage<Result> call(Request req) { // TODO: Make this method abstract after removing call(Context) return Context.safeCurrent().map(threadLocalCtx -> { // A previous action did explicitly set a context onto the thread local (via Http.Context.current.set(...)) // Let's use that context so the user doesn't loose data he/she set onto that ctx (args,...) Context newCtx = threadLocalCtx.withRequest(req.removeAttr(CTX_ARGS)); Context.setCurrent(newCtx); return call(newCtx); }).orElseGet(() -> { // A previous action did not set a context explicitly, we simply create a new one to pass on the request Context ctx = new Context(req.removeAttr(CTX_ARGS), contextComponents); ctx.args = req.attrs().getOptional(CTX_ARGS).orElse(new HashMap<>()); return call(ctx); }); }
/** * Executes this action with the given HTTP request and returns the result. * * @param req the http request with which to execute this action * @return a promise to the action's result */ public CompletionStage<Result> call(Request req) { // TODO: Make this method abstract after removing call(Context) return Context.safeCurrent().map(threadLocalCtx -> { // A previous action did explicitly set a context onto the thread local (via Http.Context.current.set(...)) // Let's use that context so the user doesn't loose data he/she set onto that ctx (args,...) Context newCtx = threadLocalCtx.withRequest(req.removeAttr(CTX_ARGS)); Context.setCurrent(newCtx); return call(newCtx); }).orElseGet(() -> { // A previous action did not set a context explicitly, we simply create a new one to pass on the request Context ctx = new Context(req.removeAttr(CTX_ARGS), contextComponents); ctx.args = req.attrs().getOptional(CTX_ARGS).orElse(new HashMap<>()); return call(ctx); }); }
/** * Executes this action with the given HTTP request and returns the result. * * @param req the http request with which to execute this action * @return a promise to the action's result */ public CompletionStage<Result> call(Request req) { // TODO: Make this method abstract after removing call(Context) return Context.safeCurrent().map(threadLocalCtx -> { // A previous action did explicitly set a context onto the thread local (via Http.Context.current.set(...)) // Let's use that context so the user doesn't loose data he/she set onto that ctx (args,...) Context newCtx = threadLocalCtx.withRequest(req.removeAttr(CTX_ARGS)); Context.setCurrent(newCtx); return call(newCtx); }).orElseGet(() -> { // A previous action did not set a context explicitly, we simply create a new one to pass on the request Context ctx = new Context(req.removeAttr(CTX_ARGS), contextComponents); ctx.args = req.attrs().getOptional(CTX_ARGS).orElse(new HashMap<>()); return call(ctx); }); }
@Override public CompletionStage<Result> execute(final Http.RequestHeader request) throws Exception { return delegate.call((Http.Request)request); }
@Override public CompletionStage<Result> execute(final Http.RequestHeader request) throws Exception { return delegate.call((Http.Request)request); }
try { ctx.request().setUsername(username); return delegate.call(ctx).transform( new F.Function<Result, Result>() { @Override
/** * Add a flag to the request to indicate the action has passed the constraint * and call the delegate. * * @param request the request * @return the result */ protected CompletionStage<Result> authorizeAndExecute(final Http.RequestHeader request) { if(constraintAnnotationMode != ConstraintAnnotationMode.AND) { // In AND mode we don't mark an action as authorised because we want ALL (remaining) constraints to be evaluated as well! return delegate.call((Http.Request)markAsAuthorised(request)); } return delegate.call((Http.Request)request); }
/** * Add a flag to the request to indicate the action has passed the constraint * and call the delegate. * * @param request the request * @return the result */ protected CompletionStage<Result> authorizeAndExecute(final Http.RequestHeader request) { if(constraintAnnotationMode != ConstraintAnnotationMode.AND) { // In AND mode we don't mark an action as authorised because we want ALL (remaining) constraints to be evaluated as well! return delegate.call((Http.Request)markAsAuthorised(request)); } return delegate.call((Http.Request)request); }
public CompletionStage<Result> call(final Context ctx) { return Ebean.executeCall(() -> delegate.call(ctx)); } }