本文整理了Java中play.mvc.Action
类的一些代码示例,展示了Action
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Action
类的具体详情如下:
包路径:play.mvc.Action
类名称:Action
[英]An action acts as decorator for the action method call.
[中]动作充当动作方法调用的装饰器。
代码示例来源:origin: com.typesafe.play/play_2.12
@Override
public CompletionStage<Result> call(Http.Request req) {
return delegate.call(req);
}
};
代码示例来源:origin: com.typesafe.play/play_2.11
@Override
public CompletionStage<Result> call(Http.Request req) {
return delegate.call(req);
}
};
代码示例来源:origin: com.typesafe.play/play_2.10
@Override
public F.Promise<Result> call(Http.Context ctx) throws Throwable {
return delegate.call(ctx);
}
};
代码示例来源:origin: com.typesafe.play/play
@Override
public CompletionStage<Result> call(Http.Request req) {
return delegate.call(req);
}
};
代码示例来源:origin: com.typesafe.play/play_2.10
public F.Promise<Result> call(Context ctx) throws Throwable {
return delegate.call(ctx);
}
};
代码示例来源:origin: com.typesafe.play/play_2.11
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)));
}
代码示例来源:origin: com.typesafe.play/play_2.12
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)));
}
代码示例来源:origin: com.typesafe.play/play
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)));
}
代码示例来源:origin: com.typesafe.play/play_2.12
/**
* 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());
}
代码示例来源:origin: com.typesafe.play/play_2.11
/**
* 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());
}
代码示例来源:origin: com.typesafe.play/play
/**
* 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());
}
代码示例来源:origin: com.typesafe.play/play_2.11
/**
* 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);
});
}
代码示例来源:origin: com.typesafe.play/play_2.12
/**
* 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);
});
}
代码示例来源:origin: com.typesafe.play/play
/**
* 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);
});
}
代码示例来源:origin: be.objectify/deadbolt-java_2.11
@Override
public CompletionStage<Result> execute(final Http.RequestHeader request) throws Exception
{
return delegate.call((Http.Request)request);
}
代码示例来源:origin: be.objectify/deadbolt-java_2.12
@Override
public CompletionStage<Result> execute(final Http.RequestHeader request) throws Exception
{
return delegate.call((Http.Request)request);
}
代码示例来源:origin: com.typesafe.play/play_2.10
try {
ctx.request().setUsername(username);
return delegate.call(ctx).transform(
new F.Function<Result, Result>() {
@Override
代码示例来源:origin: be.objectify/deadbolt-java_2.12
/**
* 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);
}
代码示例来源:origin: be.objectify/deadbolt-java_2.11
/**
* 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);
}
代码示例来源:origin: com.typesafe.play/play-ebean
public CompletionStage<Result> call(final Context ctx) {
return Ebean.executeCall(() -> delegate.call(ctx));
}
}
内容来源于网络,如有侵权,请联系作者删除!