Package org.eweb4j.mvc.config.bean

Examples of org.eweb4j.mvc.config.bean.ResultConfigBean


    if ("true".equalsIgnoreCase(cb.getMvc().getOpen())
        || "1".equals(cb.getMvc().getOpen())) {
      StringBuilder sb = new StringBuilder();

      for (Iterator<ResultConfigBean> it = rList.iterator(); it.hasNext();) {
        ResultConfigBean r = it.next();
        if (!"forward".equalsIgnoreCase(r.getType())
            && !"redirect".equalsIgnoreCase(r.getType())
            && !"out".equalsIgnoreCase(r.getType())
            && !"action".equalsIgnoreCase(r.getType())
            && !"".equals(r.getType())) {
          sb.append("当前您填写的:( type=")
              .append(r.getType())
              .append(" )是错误的!它只能填写为:forward|redirect|out|action|留空  中的一种 ;")
              .append("\n");
        }
      }
View Full Code Here


    String parentPath = null;
    String path = null;
    String method = null;
    String showValMess = null;
    String retn = null;
    ResultConfigBean rcb = null;

    Path cls_path = cls.getAnnotation(Path.class);
    String controlReqMapVal = cls_path == null ? "" : cls_path.value();

    controlReqMapVal = StringUtil.parsePropValue(controlReqMapVal);

    if (controlReqMapVal.length() > 0 && !methodReqMapVal.startsWith("/"))
      controlReqMapVal = controlReqMapVal + "/";

    String actionName = controlReqMapVal + methodReqMapVal;
    if (actionName.startsWith("/"))
      actionName = actionName.substring(1);
    if (actionName.endsWith("/"))
      actionName = actionName.substring(0, actionName.length() - 1);

    if (props != null) {

      path = props.get(methodName + ".path");
      String _path = path == null ? methodReqMapVal : path;

      parentPath = props.get("path");
      String _parentPath = parentPath == null ? controlReqMapVal
          : parentPath;

      actionName = _parentPath + _path;

      method = props.get(methodName + ".method");
      reqMethod = method == null ? reqMethod : method;
      showValMess = props.get(methodName + ".showValMess");
      retn = props.get(methodName + ".return");
      rcb = null;
      if (retn != null) {
        rcb = new ResultConfigBean();
        rcb.setName("_props_");
        if (retn.startsWith("redirect:")) {
          rcb.setType(MVCConfigConstant.REDIRECT_TYPE);
          rcb.setLocation(retn.replace("redirect:", ""));
        } else if (retn.startsWith("forward:")) {
          rcb.setType(MVCConfigConstant.FORWARD_TYPE);
          rcb.setLocation(retn.replace("forward:", ""));
        } else if (retn.equalsIgnoreCase("null")
            || retn.equalsIgnoreCase(MVCConfigConstant.AJAX_TYPE)) {
          rcb.setType(MVCConfigConstant.AJAX_TYPE);
        } else if (retn.equalsIgnoreCase("action:")) {
          rcb.setType(MVCConfigConstant.ACTION_TYPE);
          rcb.setLocation(retn.replace("action:", ""));

        } else if (retn.startsWith("out:")) {
          rcb.setType(MVCConfigConstant.OUT_TYPE);
          rcb.setLocation(retn.replace("out:", ""));
        } else if (retn.equalsIgnoreCase(MVCConfigConstant.JSON_TYPE)) {
          rcb.setType(MVCConfigConstant.JSON_TYPE);
        } else {
          rcb.setType(MVCConfigConstant.FORWARD_TYPE);
          rcb.setLocation(retn);
        }
      }
    }
    ActionConfigBean action = new ActionConfigBean();
    action.setShowValErrorType(showValMess == null ? valErrType
View Full Code Here

    if ("true".equalsIgnoreCase(cb.getMvc().getOpen())
        || "1".equals(cb.getMvc().getOpen())) {
      StringBuilder sb = new StringBuilder();

      for (Iterator<ResultConfigBean> it = rList.iterator(); it.hasNext();) {
        ResultConfigBean r = it.next();
        if (!"forward".equalsIgnoreCase(r.getType())
            && !"redirect".equalsIgnoreCase(r.getType())
            && !"out".equalsIgnoreCase(r.getType())
            && !"action".equalsIgnoreCase(r.getType())
            && !"".equals(r.getType())) {
          sb.append("当前您填写的:( type=")
              .append(r.getType())
              .append(" )是错误的!它只能填写为:forward|redirect|out|action|留空  中的一种 ;")
              .append("\n");
        }
      }
View Full Code Here

public class MVCConfigBeanCreator {
  public static ActionConfigBean getActionBean() {
    ActionConfigBean mvcBean = null;
    mvcBean = new ActionConfigBean();
    List<ResultConfigBean> rlist = new ArrayList<ResultConfigBean>();
    ResultConfigBean result = new ResultConfigBean();
    rlist.add(result);
    mvcBean.setResult(rlist);
   
    List<ValidatorConfigBean> vlist = new ArrayList<ValidatorConfigBean>();
    ValidatorConfigBean validator = new ValidatorConfigBean();
View Full Code Here

    List<ResultConfigBean> rList = new ArrayList<ResultConfigBean>();
    String[] name = resultAnn.name();
    String[] type = resultAnn.type();
    String[] location = resultAnn.value();
    for (int a = 0; a < name.length; ++a) {
      ResultConfigBean r = new ResultConfigBean();

      r.setName(StringUtil.parsePropValue(name[a]));
      r.setType(StringUtil.parsePropValue(type[a]));
      r.setLocation(StringUtil.parsePropValue(location[a]));
      rList.add(r);
    }

    return rList;
  }
View Full Code Here

    ActionConfigBean acb = new ActionConfigBean();

    if (ActionMethod.INDEX.equals(methodName)) {
      uriMapping = "/";
      httpMethod = HttpMethod.GET;
      ResultConfigBean rcb = new ResultConfigBean();
      rcb.setName("jsp");
      rcb.setLocation(moduleName + "/view/index.jsp");
      acb.getResult().add(rcb);
      ResultConfigBean rcb2 = new ResultConfigBean();
      rcb2.setName("html");
      rcb2.setType(RenderType.FREEMARKER);
      rcb2.setLocation(moduleName + "/view/index.html");
      acb.getResult().add(rcb2);
    } else if (ActionMethod.CREATE.equals(methodName)) {
      uriMapping = "/";
      httpMethod = HttpMethod.POST;

      ResultConfigBean rcb = new ResultConfigBean();
      rcb.setName(ActionMethod.INDEX);
      rcb.setLocation(moduleName);
      rcb.setType(RenderType.ACTION);
      acb.getResult().add(rcb);
    } else if (ActionMethod.UPDATE.equals(methodName)) {
      uriMapping = "/{id}";
      httpMethod = HttpMethod.PUT;
      ResultConfigBean rcb = new ResultConfigBean();
      rcb.setName(ActionMethod.INDEX);
      rcb.setLocation(moduleName);
      rcb.setType(RenderType.ACTION);
      acb.getResult().add(rcb);
    } else if (ActionMethod.SHOW.equals(methodName)) {
      uriMapping = "/{id}";
      httpMethod = HttpMethod.GET;

      ResultConfigBean rcb = new ResultConfigBean();
      rcb.setName("jsp");
      rcb.setLocation(moduleName + "/view/show.jsp");
      acb.getResult().add(rcb);
      ResultConfigBean rcb2 = new ResultConfigBean();
      rcb2.setName("html");
      rcb2.setType(RenderType.FREEMARKER);
      rcb2.setLocation(moduleName + "/view/show.html");
      acb.getResult().add(rcb2);
    } else if (ActionMethod.EDIT.equals(methodName)) {
      uriMapping = "/{id}/edit";
      httpMethod = HttpMethod.GET;
      ResultConfigBean rcb = new ResultConfigBean();
      rcb.setName("jsp");
      rcb.setLocation(moduleName + "/view/edit.jsp");
      acb.getResult().add(rcb);
      ResultConfigBean rcb2 = new ResultConfigBean();
      rcb2.setName("html");
      rcb2.setType(RenderType.FREEMARKER);
      rcb2.setLocation(moduleName + "/view/edit.html");
      acb.getResult().add(rcb2);
    } else if (ActionMethod.DESTROY.equals(methodName)) {
      uriMapping = "/{id}";
      httpMethod = HttpMethod.DELETE;

      ResultConfigBean rcb = new ResultConfigBean();
      rcb.setName(ActionMethod.INDEX);
      rcb.setLocation(moduleName);
      rcb.setType(RenderType.ACTION);
      acb.getResult().add(rcb);
    } else if (ActionMethod.NEW.equals(methodName)) {
      uriMapping = "/new";
      httpMethod = HttpMethod.GET;
      ResultConfigBean rcb = new ResultConfigBean();
      rcb.setName("jsp");
      rcb.setLocation(moduleName + "/view/new.jsp");
      acb.getResult().add(rcb);
      ResultConfigBean rcb2 = new ResultConfigBean();
      rcb2.setName("html");
      rcb2.setType(RenderType.FREEMARKER);
      rcb2.setLocation(moduleName + "/view/new.html");
      acb.getResult().add(rcb2);
    } else {
      acb = null;
    }
View Full Code Here

TOP

Related Classes of org.eweb4j.mvc.config.bean.ResultConfigBean

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.