Search in sources :

Example 11 with HongsExpedient

use of app.hongs.HongsExpedient in project HongsCORE by ihongs.

the class JointGate method acting.

@Override
public void acting(ActionHelper helper, ActionRunner runner) throws HongsException {
    String act = runner.getHandle();
    String ent = runner.getEntity();
    String mod = runner.getModule();
    try {
        // 探测实体是否为独占模块, 方便自动机处理
        if (FormSet.hasConfFile(mod + "/" + ent)) {
            mod = mod + "/" + ent;
            runner.setModule(mod);
        }
        // 下划线开头的为内部资源, 不直接对外开放
        if (ent.startsWith("_")) {
            throw new HongsException(0x1100, "Unsupported Request!");
        }
        // 判断是否禁用了当前动作, 忽略表单不存在
        Map fa = FormSet.getInstance(mod).getForm(ent);
        Set ca = Synt.toSet(Dict.getDepth(fa, "@", "callable"));
        if (ca != null && !ca.contains(act)) {
            throw new HongsException(0x1100, "Unsupported Request.");
        }
    } catch (HongsException | HongsExpedient ex) {
        int ec = ex.getErrno();
        if (ec != 0x10e8 && ec != 0x10ea) {
            throw ex;
        }
    }
}
Also used : Set(java.util.Set) FormSet(app.hongs.action.FormSet) HongsException(app.hongs.HongsException) HongsExpedient(app.hongs.HongsExpedient) NaviMap(app.hongs.action.NaviMap) Map(java.util.Map)

Aggregations

HongsExpedient (app.hongs.HongsExpedient)11 HongsException (app.hongs.HongsException)7 Map (java.util.Map)7 HashMap (java.util.HashMap)5 Core (app.hongs.Core)4 HongsError (app.hongs.HongsError)4 CoreConfig (app.hongs.CoreConfig)3 ActionHelper (app.hongs.action.ActionHelper)2 FormSet (app.hongs.action.FormSet)2 NaviMap (app.hongs.action.NaviMap)2 IOException (java.io.IOException)2 HashSet (java.util.HashSet)2 Set (java.util.Set)2 ServletException (javax.servlet.ServletException)2 Part (javax.servlet.http.Part)2 CoreLocale (app.hongs.CoreLocale)1 ActionRunner (app.hongs.action.ActionRunner)1 Color (java.awt.Color)1 File (java.io.File)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1