use of act.app.ActionContext in project actframework by actframework.
the class FileBinder method resolve.
@Override
public File resolve(File file, String s, ParamValueProvider paramValueProvider) {
ActionContext ctx = $.cast(paramValueProvider);
ISObject sobj = ctx.upload(s);
return null == sobj ? null : sobj.asFile();
}
use of act.app.ActionContext in project actframework by actframework.
the class Router method urlBase.
public String urlBase() {
ActionContext context = ActionContext.current();
if (null != context) {
return urlBase(context);
}
AppConfig<?> config = Act.appConfig();
/*
* Note we support named port (restricted access) is running in the scope of
* the internal network, thus assume we do not have secure http channel on top
* of that
*/
boolean secure = null != portId && config.httpSecure();
String scheme = secure ? "https" : "http";
String domain = config.host();
if (80 == port || 443 == port) {
return S.concat(scheme, "://", domain);
} else {
return S.concat(scheme, "://", domain, ":", S.string(port));
}
}
use of act.app.ActionContext in project actframework by actframework.
the class ActResponse method afterWritingContent.
public void afterWritingContent() {
if (ready) {
return;
}
commit();
ActionContext ctx = context();
MvcConfig.applyAfterCommitResultHandler(Ok.get(), ctx.req(), this);
}
use of act.app.ActionContext in project actframework by actframework.
the class ActResponse method beforeWritingContent.
public void beforeWritingContent() {
if (ready) {
return;
}
ActionContext ctx = context();
ctx.dissolve();
MvcConfig.applyBeforeCommitResultHandler(Ok.get(), ctx.req(), this);
}
use of act.app.ActionContext in project actframework by actframework.
the class RequestScope method get.
@Override
public <T> T get(String key) {
ActionContext actionContext = ActionContext.current();
if (null != actionContext) {
return actionContext.attribute(key);
}
CliContext cliContext = CliContext.current();
if (null != cliContext) {
return cliContext.attribute(key);
}
return null;
}
Aggregations