org.osgl.mvc.annotation.GetAction Java Examples

The following examples show how to use org.osgl.mvc.annotation.GetAction. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Test.java    From actframework with Apache License 2.0 6 votes vote down vote up
@GetAction("test/result")
@PropertySpec("error, scenario.partition, scenarios.name, scenarios.ignoreReason, scenarios.ignore, scenarios.source, scenarios.status, " +
        "scenarios.issueUrl, scenarios.issueUrlIcon, scenarios.title, scenarios.errorMessage, " +
        "scenarios.interactions.status, scenarios.interactions.description, " +
        "scenarios.interactions.stackTrace, scenarios.interactions.errorMessage")
public Map<String, Object> result() {
    Map<String, Object> ret = new HashMap<>();
    ret.put("scenarios", result);
    Map<String, String> err = new HashMap<>();
    if (null != this.error) {
        err.put("message", this.error.getMessage());
        err.put("stackTrace", E.stackTrace(this.error));
        ret.put("error", err);
    }
    return ret;
}
 
Example #2
Source File: GH434.java    From actframework with Apache License 2.0 5 votes vote down vote up
@GetAction("conf")
public void testConfigured() {
    illegalStateIf(null == configuredServices);
    illegalStateIf(configuredServices.size() != 3);
    for (Service svc : configuredServices) {
        illegalStateIf(null == svc);
    }
}
 
Example #3
Source File: Gh1093Service.java    From actframework with Apache License 2.0 5 votes vote down vote up
@GetAction("users")
@Command("1092.users")
public List<Gh1093User> listUsers() {
    List<Gh1093User> list = new ArrayList<>();
    Gh1093Department dep = new Gh1093Department();
    dep.name = "RD";
    Gh1093User green = new Gh1093User();
    list.add(green);
    green.name = "green";
    green.department = dep;
    dep.users.add(green);
    return list;
}
 
Example #4
Source File: OsglTool181.java    From actframework with Apache License 2.0 5 votes vote down vote up
@GetAction
public Kit test181() {
    Kit kit = new Kit();
    kit.putValue("DisplayName", "Primary Kit - kids aged 5-9 (unavailable - restock due 2019)");

    JSONObject newData = new JSONObject();
    newData.put("DisplayName", "Primary Kit - kids aged 5-9");
    $.merge(newData).to(kit);

    return kit;
}
 
Example #5
Source File: GH325.java    From actframework with Apache License 2.0 5 votes vote down vote up
@GetAction("person/{name};{attributes}/{key}")
public String test2(String name, Map<String, Integer> attributes, String key) {
    if (S.eq("name", key)) {
        return name;
    }
    return S.string(attributes.get(key));
}
 
Example #6
Source File: CsrfConfAdmin.java    From actframework with Apache License 2.0 5 votes vote down vote up
@GetAction({"csrf", "xsrf"})
public JSONObject csrfConf() {
    JSONObject retVal = new JSONObject();
    retVal.put("cookieName", appConfig.csrfCookieName());
    retVal.put("headerName", appConfig.csrfHeaderName());
    retVal.put("paramName", appConfig.csrfParamName());
    return retVal;
}
 
Example #7
Source File: VoidOkWithNotFound.java    From actframework with Apache License 2.0 5 votes vote down vote up
@GetAction("/")
public void handle(boolean notFound) {
    if (notFound) {
        notFound("blah blah");
    }
    ok();
}
 
Example #8
Source File: Gh1026.java    From actframework with Apache License 2.0 5 votes vote down vote up
@GetAction
public Foo get() {
    Foo foo = new Foo();
    foo.permissions.put("admin", "admin.create");
    foo.permissions.put("admin", "admin.update");
    foo.permissions.put("admin", "admin.delete");
    foo.permissions.put("user", "user.create");
    foo.permissions.put("user", "user.delete");
    return foo;
}
 
Example #9
Source File: GH473.java    From actframework with Apache License 2.0 5 votes vote down vote up
@GetAction("str")
public String testString(String suffix, Integer level, EventBus eventBus) {
    if (null != level) {
        eventBus.trigger("FOO", level);
    } else {
        eventBus.trigger("FOO", suffix);
    }
    return S.concat(context.attribute("foo"), context.attribute("foo3"));
}
 
Example #10
Source File: SimpleBeanTestBed.java    From actframework with Apache License 2.0 5 votes vote down vote up
@GetAction("getter/boolean_getter_exists")
public void itShallNotGenerateGetterForBooleanPropertyIfAlreadyExists() {
    SimpleBeanWithoutDefaultConstructor bean = new SimpleBeanWithoutDefaultConstructor("foo");
    if (!bean.magicFlag) {
        throw new UnexpectedException();
    }
}
 
Example #11
Source File: GH222.java    From actframework with Apache License 2.0 5 votes vote down vote up
@GetAction("222")
public void check() {
    Act.LOGGER.info(S.concat("sync: ", S.string(syncThreadId), "\tasync: ", S.string(asyncThreadId)));
    if (syncThreadId == asyncThreadId) {
        throw new RuntimeException("failed");
    }
}
 
Example #12
Source File: AttachmentController.java    From AnnZone with MIT License 5 votes vote down vote up
/**
 * 获取附件详情
 * @param id
 * @return
 */
@GetAction("view")
public RenderJSON view(String id){
    if (!StringUtils.isNumeric(id)){
        v1BaseBean.setStatus(1);
        v1BaseBean.setMsg("附件ID不合法");
        v1BaseBean.setResult(0);
        throw json(v1BaseBean);
    }
    long _id = Long.valueOf(id);
    try {
        Ann_attachment ann_attachment = annAttachmentEbeanDao.findOneBy("id",_id);
        if (null != ann_attachment){
            v1BaseBean.setExp(Constant.exp+new Date().getTime());
            v1BaseBean.setMsg("附件详情获取成功!");
            v1BaseBean.setStatus(0);
            v1BaseBean.setData(ann_attachment);
            v1BaseBean.setResult(1);
            v1BaseBean.setTime(new Date().getTime());
            return json(v1BaseBean);
        }else {
            v1BaseBean.setStatus(14);
            v1BaseBean.setMsg("附件不存在");
            v1BaseBean.setExp(-1);
            return json(v1BaseBean);
        }
    }catch (Exception e){
        v1BaseBean.setStatus(14);
        v1BaseBean.setMsg("附件不存在");
        v1BaseBean.setExp(-1);
        return json(v1BaseBean);
    }

}
 
Example #13
Source File: ProjectController.java    From AnnZone with MIT License 5 votes vote down vote up
/**
 * 获取项目列表接口
 * @return
 */
@GetAction("list")
public RenderJSON list(){
    List<Ann_project> ann_projects = annProjectEbeanDao.findAllAsList();
    v1BaseBean.setData(ann_projects);
    v1BaseBean.setResult(ann_projects.size());
    v1BaseBean.setStatus(0);
    v1BaseBean.setMsg("项目列表请求成功!");
    v1BaseBean.setExp(Constant.exp+new Date().getTime());
    v1BaseBean.setTime(new Date().getTime());
    return json(v1BaseBean);
}
 
Example #14
Source File: Gh829.java    From actframework with Apache License 2.0 5 votes vote down vote up
@GetAction
@DownloadFilename("foo")
public List<Foo> testStatic(ActionContext context, String nonce) {
    if (S.notBlank(nonce)) {
        context.downloadFileName("foo-" + nonce);
    }
    return foos;
}
 
Example #15
Source File: Gh857.java    From actframework with Apache License 2.0 5 votes vote down vote up
@GetAction
public List<String> test() {
    return C.list(services).map(new $.Transformer<Service857, String>() {
        @Override
        public String transform(Service857 service857) {
            return service857.name();
        }
    });
}
 
Example #16
Source File: Gh908.java    From actframework with Apache License 2.0 4 votes vote down vote up
@GetAction
public DateTime test() {
    return DateTime.now().withMillisOfSecond(0);
}
 
Example #17
Source File: Gh835.java    From actframework with Apache License 2.0 4 votes vote down vote up
@GetAction("withSpecificAdvice")
@ReturnValueAdvisor(GenkoAdvice.class)
public String test1() {
    return "Hello Genko!";
}
 
Example #18
Source File: CORSTestBed.java    From actframework with Apache License 2.0 4 votes vote down vote up
@CORS.AllowOrigin(FOO_ALLOW_ORIGIN)
@GetAction("foo")
public static void foo() {
}
 
Example #19
Source File: Gh1130.java    From actframework with Apache License 2.0 4 votes vote down vote up
@GetAction
@FastJsonPropertyNamingStrategy(PropertyNamingStrategy.SnakeCase)
public Gh1130Model test() {
    return new Gh1130Model();
}
 
Example #20
Source File: ModelController.java    From actframework with Apache License 2.0 4 votes vote down vote up
@GetAction("/")
public Result handle() {
    return ok();
}
 
Example #21
Source File: Gh1286.java    From actframework with Apache License 2.0 4 votes vote down vote up
@GetAction
public TestResp test() {
    return resp;
}
 
Example #22
Source File: GH301.java    From actframework with Apache License 2.0 4 votes vote down vote up
@GetAction
public List<GH301Model> test(@DbBind(field = "name") List<GH301Model> list) {
    return list;
}
 
Example #23
Source File: Gh1118.java    From actframework with Apache License 2.0 4 votes vote down vote up
@GetAction
@PropertySpec("count, bar")
public Iterable<Foo> test() {
    return C.list(new Foo());
}
 
Example #24
Source File: GH352.java    From actframework with Apache License 2.0 4 votes vote down vote up
@GetAction
public String test(ViewManager viewManager) {
    return viewManager.getTemplate("/gh/352/test.html").render(context);
}
 
Example #25
Source File: Order.java    From actframework with Apache License 2.0 4 votes vote down vote up
@GetAction
public Iterable<Order> list() {
    List<Order> orders = findAllAsList();
    return orders;
}
 
Example #26
Source File: CliOverHttp.java    From actframework with Apache License 2.0 4 votes vote down vote up
@GetAction("cmd")
public Result cmdPanel(String cmd) {
    CliHandler handler = handler(cmd);
    return render(handler, dispatcher, cmd);
}
 
Example #27
Source File: GH631.java    From actframework with Apache License 2.0 4 votes vote down vote up
@GetAction("{header}")
public String test(String header, H.Request req) {
    return req.header(header);
}
 
Example #28
Source File: CSPTestBed.java    From actframework with Apache License 2.0 4 votes vote down vote up
@GetAction
public void entry() {
}
 
Example #29
Source File: Info.java    From actframework with Apache License 2.0 4 votes vote down vote up
@GetAction("info")
@Description("Show application info including version, scan package, base dir and profile")
public void show(ActionContext context) {
    info.applyTo(context);
}
 
Example #30
Source File: GH289.java    From actframework with Apache License 2.0 4 votes vote down vote up
@GetAction
public void test() {
    String who = "World";
    render("Hello @who!", who);
}