Search in sources :

Example 1 with ActionContext

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();
}
Also used : ISObject(org.osgl.storage.ISObject) ActionContext(act.app.ActionContext)

Example 2 with ActionContext

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));
    }
}
Also used : ActionContext(act.app.ActionContext)

Example 3 with ActionContext

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);
}
Also used : ActionContext(act.app.ActionContext)

Example 4 with ActionContext

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);
}
Also used : ActionContext(act.app.ActionContext)

Example 5 with ActionContext

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;
}
Also used : ActionContext(act.app.ActionContext) CliContext(act.cli.CliContext)

Aggregations

ActionContext (act.app.ActionContext)15 CliContext (act.cli.CliContext)4 H (org.osgl.http.H)3 CliSession (act.cli.CliSession)2 ActResponse (act.ActResponse)1 JsonDTO (act.inject.param.JsonDTO)1 UrlPath (act.route.UrlPath)1 Template (act.view.Template)1 Format (org.osgl.http.H.Format)1 MvcConfig (org.osgl.mvc.MvcConfig)1 GetAction (org.osgl.mvc.annotation.GetAction)1 ISObject (org.osgl.storage.ISObject)1 S (org.osgl.util.S)1