@SuppressWarnings("unchecked")
 public void execute(
     Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body)
     throws TemplateException, IOException {
   CmsSite site = FrontUtils.getSite(env);
   InvokeType type = DirectiveUtils.getInvokeType(params);
   Pagination page =
       bbsTopicMng.getMemberTopic(
           site.getId(),
           getCreaterId(params),
           FrontUtils.getPageNo(env),
           FrontUtils.getCount(params));
   Map<String, TemplateModel> paramWrap = new HashMap<String, TemplateModel>(params);
   paramWrap.put(OUT_PAGINATION, DEFAULT_WRAPPER.wrap(page));
   Map<String, TemplateModel> origMap = DirectiveUtils.addParamsToVariable(env, paramWrap);
   if (InvokeType.custom == type) {
     FrontUtils.includeTpl(TPL_MY_TOPIC, site, params, env);
     FrontUtils.includePagination(site, params, env);
   } else if (InvokeType.body == type) {
     body.render(env.getOut());
     FrontUtils.includePagination(site, params, env);
   } else {
     throw new RuntimeException("invoke type not handled: " + type);
   }
   DirectiveUtils.removeParamsFromVariable(env, paramWrap, origMap);
 }
Пример #2
0
 @SuppressWarnings("rawtypes")
 public void execute(
     Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body)
     throws TemplateException, IOException {
   RequestAttributes requestAttributes = RequestContextHolder.currentRequestAttributes();
   if (requestAttributes != null) {
     Message message =
         (Message)
             requestAttributes.getAttribute(
                 FLASH_MESSAGE_ATTRIBUTE_NAME, RequestAttributes.SCOPE_REQUEST);
     if (body != null) {
       setLocalVariable(VARIABLE_NAME, message, env, body);
     } else {
       if (message != null) {
         Writer out = env.getOut();
         out.write(
             "data-msg-type=\""
                 + message.getType()
                 + "\" data-msg-content=\""
                 + message.getContent()
                 + "\"");
       }
     }
   }
 }
 /**
  * @param env
  * @param body
  * @param variables
  * @throws TemplateException
  * @throws IOException
  */
 public void render(
     Environment env, TemplateDirectiveBody body, Map<String, TemplateModel> variables)
     throws TemplateException, IOException {
   Map<String, TemplateModel> origVariables = addVariables(env, variables);
   body.render(env.getOut());
   removeVariables(env, variables, origVariables);
 }
  @SuppressWarnings("unchecked")
  public void execute(
      Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body)
      throws TemplateException, IOException {
    CmsSite site = FrontUtils.getSite(env);
    List<ContentTag> list = contentTagMng.getListForTag(FrontUtils.getCount(params));

    Map<String, TemplateModel> paramWrap = new HashMap<String, TemplateModel>(params);
    paramWrap.put(OUT_LIST, DEFAULT_WRAPPER.wrap(list));
    Map<String, TemplateModel> origMap = DirectiveUtils.addParamsToVariable(env, paramWrap);
    InvokeType type = DirectiveUtils.getInvokeType(params);
    String listStyle = DirectiveUtils.getString(PARAM_STYLE_LIST, params);
    if (InvokeType.sysDefined == type) {
      if (StringUtils.isBlank(listStyle)) {
        throw new ParamsRequiredException(PARAM_STYLE_LIST);
      }
      env.include(TPL_STYLE_LIST + listStyle + TPL_SUFFIX, UTF8, true);
    } else if (InvokeType.userDefined == type) {
      if (StringUtils.isBlank(listStyle)) {
        throw new ParamsRequiredException(PARAM_STYLE_LIST);
      }
      FrontUtils.includeTpl(TPL_STYLE_LIST, site, env);
    } else if (InvokeType.custom == type) {
      FrontUtils.includeTpl(TPL_NAME, site, params, env);
    } else if (InvokeType.body == type) {
      body.render(env.getOut());
    } else {
      throw new RuntimeException("invoke type not handled: " + type);
    }
    DirectiveUtils.removeParamsFromVariable(env, paramWrap, origMap);
  }
Пример #5
0
  public void execute(
      Environment env, Map map, TemplateModel[] loopVars, TemplateDirectiveBody body)
      throws TemplateException, IOException {

    Iterator<?> it = map.entrySet().iterator();
    String name = "";
    String id = "";
    String clazz = "";
    String defaultvalue = "";
    String nid = "";
    String disabled = "";
    String type = "";
    String noselect = "";
    int typeid = 0;
    boolean plantext = false;
    while (it.hasNext()) {
      Map.Entry<?, ?> entry = (Map.Entry) it.next();
      String paramName = entry.getKey().toString();
      TemplateModel paramValue = (TemplateModel) entry.getValue();
      if (paramName.equals("plantext")) {
        if (!(paramValue instanceof TemplateBooleanModel)) {
          throw new TemplateModelException(
              "The \"" + plantext + "\" parameter " + "must be a boolean.");
        }
        plantext = ((TemplateBooleanModel) paramValue).getAsBoolean();
      }
      if (paramName.equals("name")) {
        name = paramValue.toString();
      } else if (paramName.equals("id")) {
        id = paramValue.toString();
      } else if (paramName.equals("class")) {
        clazz = paramValue.toString();
      } else if (paramName.equals("default")) {
        defaultvalue = paramValue.toString();
      } else if (paramName.equals("nid")) {
        nid = paramValue.toString();
      } else if (paramName.equals("disabled")) {
        disabled = paramValue.toString();
      } else if (paramName.equals("noselect")) {
        noselect = paramValue.toString();
      } else if (paramName.equals("type")) {
        type = paramValue.toString();
      } else if (paramName.equals("typeid")) {
        if (!(paramValue instanceof TemplateNumberModel)) {
          throw new TemplateModelException("The \"typeid\" parameter must be a number.");
        }

        typeid = ((TemplateNumberModel) paramValue).getAsNumber().intValue();
      }
    }
    String result = "";
    if (plantext)
      result = plaintext(name, id, clazz, defaultvalue, typeid, nid, disabled, type, noselect);
    else {
      result = html(name, id, clazz, defaultvalue, typeid, nid, disabled, type, noselect);
    }
    Writer out = env.getOut();
    out.write(result);
  }
Пример #6
0
 public void execute(
     Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body)
     throws TemplateException, IOException {
   Integer folderId = Integer.parseInt(params.get("folderId").toString());
   String basePath = HttpUtils.getBasePath(request);
   try {
     Folder folder = folderService.getFolderById(folderId);
     if (Boolean.getBoolean(PropertyUtils.getValue("shishuo.static"))) {
       env.getOut().write(basePath + "/html/folder/" + folder.getEname() + ".html");
     } else {
       env.getOut()
           .write(basePath + "/folder/" + folder.getEname() + ".htm?classifyId=" + folderId);
     }
   } catch (FolderNotFoundException e) {
     e.printStackTrace();
   }
 }
Пример #7
0
 @Override
 public void execute(
     Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body)
     throws TemplateException, IOException {
   Integer count = Integer.valueOf(params.get("count").toString());
   for (int i = 0; i < count.intValue(); i++) {
     body.render(env.getOut());
   }
 }
Пример #8
0
  @Override
  public void execute(Environment e, Map map, TemplateModel[] tms, TemplateDirectiveBody tdb)
      throws TemplateException, IOException {
    tagParameter = map;
    request = (HttpServletRequest) e.getCustomAttribute("request");
    urlSetter = (URLQueryHandler) e.getCustomAttribute("urlSetter");
    out = e.getOut();

    HashMap<String, Object> mapx = this.doService();
    if (mapx != null) {
      for (Entry<String, Object> c : mapx.entrySet()) {
        e.setVariable(c.getKey(), ObjectWrapper.DEFAULT_WRAPPER.wrap(c.getValue()));
      }
    }

    if (tdb != null) {
      tdb.render(e.getOut());
    }
  }
Пример #9
0
  @Override
  public void execute(Environment e, Map map, TemplateModel[] tms, TemplateDirectiveBody tdb)
      throws TemplateException, IOException {
    HttpServletRequest request = (HttpServletRequest) e.getCustomAttribute("request");
    URLQueryHandler urlSetter = (URLQueryHandler) e.getCustomAttribute("urlSetter");

    String controllerName = map.get("provider").toString();
    String actionName = map.get("method").toString();
    String dataname = map.get("name").toString();

    HashMap<String, Object> ct = (HashMap<String, Object>) map;

    try {
      String className = JpageController.get().getClassName(controllerName);
      if (className != null && className.length() > 0) {
        Object x = Class.forName(className).newInstance();
        HashMap<String, Object> mapx = new HashMap<String, Object>();
        mapx.put("out", e.getOut());
        mapx.put("request", request);
        mapx.put("parameters", ct);
        mapx.put("urlSetter", urlSetter);

        ObjectSnooper obj = ObjectSnooper.snoop(x);
        obj.sett(mapx);
        obj.set(this._get(request));
        Object result = obj.trigger(actionName);
        obj.triggerr("close");

        HashMap<String, Object> xxtmap = new HashMap<String, Object>();
        Object xtt = obj.gett("local");
        if (xtt != null) {
          xxtmap = (HashMap<String, Object>) xtt;
        }
        e.setVariable(dataname, ObjectWrapper.DEFAULT_WRAPPER.wrap(result));
        e.setVariable(dataname + "_local", ObjectWrapper.DEFAULT_WRAPPER.wrap(xxtmap));
      }
    } catch (Exception ex) {
      ex.printStackTrace();
    }
    if (tdb != null) {
      tdb.render(e.getOut());
    }
  }
Пример #10
0
  @Override
  public void execute(
      Environment env,
      Map map,
      TemplateModel[] templateModel,
      TemplateDirectiveBody templateDirectiveBody)
      throws TemplateException, IOException {
    StringModel stringModel = (StringModel) map.get("archive");
    ArchiveReport archiveReport = (ArchiveReport) stringModel.getWrappedObject();
    Map<String, Integer> data = PieSerializer.recursePie(archiveReport);
    if (data.keySet().size() > 0) {
      env.getOut().append("<div class='rightColumn'>");
      env.getOut().append("<div class='windupPieGraph'>");
      PieSerializer.drawPie(env.getOut(), archiveReport.getRelativePathFromRoot(), data);
      env.getOut().append("</div>");
      env.getOut().append("</div>");
    }

    draw(env.getOut(), archiveReport);
  }
Пример #11
0
  @Override
  public void execute(
      Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body)
      throws TemplateException, IOException {

    String sql = params.get("sql").toString();
    System.out.println(loopVars.length);
    System.out.println(sql);
    Channel r = new Channel();
    r.setName("dsadsadasd");
    List a = new ArrayList();
    a.add(r);
    a.add(r);
    a.add(r);
    a.add(r);
    a.add(r);
    env.setVariable("userlist", ObjectWrapper.DEFAULT_WRAPPER.wrap(a));

    env.getOut().write("3424234234");
    body.render(env.getOut());
  }
  @Override
  public void execute(
      Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body)
      throws TemplateException, IOException {

    String siteLanguage = LocaleContextHolder.getLocale().getLanguage();
    String langValue = ((TemplateScalarModel) params.get("lang")).getAsString();

    if (langValue.equals(siteLanguage)) {
      body.render(env.getOut());
    }
  }
Пример #13
0
  public void execute(
      Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body)
      throws TemplateException, IOException {

    String pic = params.get("pic").toString();
    if (StringUtil.isEmpty(pic))
      pic = "http://" + EopSetting.IMG_SERVER_DOMAIN + "/images/no_picture.jpg";
    if (pic.startsWith("fs:")) {
      pic = UploadUtil.replacePath(pic);
    }
    String postfix = params.get("postfix").toString();
    env.getOut().write(UploadUtil.getThumbPath(pic, postfix));
  }
Пример #14
0
  public void execute(
      Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body)
      throws TemplateException, IOException {

    // 获取参数
    // 信息id
    String infoid = getParam(params, "infoid");
    Writer out = env.getOut();
    if (body != null) {
      // 设置循环变量
      if (loopVars != null && loopVars.length > 0 && infoid.trim().length() > 0) {
        // 查询信息图片集
        InfoImg infoImg = new InfoImg();
        infoImg.setInfoid(infoid);
        List<InfoImg> infoImgList = infoImgService.find(infoImg, " ordernum ");
        if (infoImgList != null && infoImgList.size() > 0) {
          loopVars[0] = new ArrayModel(infoImgList.toArray(), new BeansWrapper());
          body.render(env.getOut());
        }
      }
    }
  }
Пример #15
0
  @Override
  public void execute(
      Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body)
      throws TemplateException, IOException {
    long beginTime = System.currentTimeMillis();

    Map<String, TemplateModel> paramsWrap = putRes(env, params, loopVars, body);
    Map<String, TemplateModel> origMap = DirectiveUtils.addParamsToVariable(env, paramsWrap);
    body.render(env.getOut());
    DirectiveUtils.removeParamsFromVariable(env, paramsWrap, origMap);
    long endTime = System.currentTimeMillis();
    log.debug(this.getClass().getName() + ":共耗时" + String.valueOf(endTime - beginTime) + "微秒");
  }
Пример #16
0
  public void execute(
      Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body)
      throws TemplateException, IOException {

    TemplateDirectiveBodyOverrideWraper current =
        (TemplateDirectiveBodyOverrideWraper) env.getVariable(DirectiveUtils.OVERRIDE_CURRENT_NODE);
    if (current == null) {
      throw new TemplateException("<@super/> direction must be child of override", env);
    }
    TemplateDirectiveBody parent = current.parentBody;
    if (parent == null) {
      throw new TemplateException("not found parent for <@super/>", env);
    }
    parent.render(env.getOut());
  }
Пример #17
0
  @Override
  public void execute(
      Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body)
      throws TemplateException, IOException {

    Integer folderId = Integer.parseInt(params.get("folderId").toString());

    try {
      Folder folder = folderService.getFolderById(folderId);
      env.setVariable("tag_folder", DEFAULT_WRAPPER.wrap(folder));
    } catch (FolderNotFoundException e) {
      env.setVariable("tag_folder", DEFAULT_WRAPPER.wrap(new Folder()));
    }
    body.render(env.getOut());
  }
 /*    */ public void execute(
     Environment env, Map params, TemplateModel[] arg2, TemplateDirectiveBody arg3)
     /*    */ throws TemplateException, IOException
       /*    */ {
   /* 20 */ String pageno = params.get("pageno").toString();
   /* 21 */ String pagesize = params.get("pagesize").toString();
   /* 22 */ String totalcount = params.get("totalcount").toString();
   /* 23 */ int _pageNum = Integer.valueOf(pageno).intValue();
   /* 24 */ int _totalCount = Integer.valueOf(totalcount).intValue();
   /* 25 */ int _pageSize = Integer.valueOf(pagesize).intValue();
   /* 26 */ AjaxPagerHtmlBuilder pageHtmlBuilder =
       new AjaxPagerHtmlBuilder(_pageNum, _totalCount, _pageSize);
   /* 27 */ String html = pageHtmlBuilder.buildPageHtml();
   /* 28 */ env.getOut().write(html);
   /*    */ }
Пример #19
0
 /*    */ public void execute(
     Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body)
     /*    */ throws TemplateException, IOException
       /*    */ {
   /* 32 */ Site site = ViewTools.getSite(env);
   /* 33 */ Integer parentId = TagModelTools.getInt("parentId", params);
   /* 34 */ List industryList = new ArrayList();
   /* 35 */ if (parentId != null)
     /* 36 */ industryList = this.industryService.getIndustryChild(parentId);
   /*    */ else {
     /* 38 */ industryList = this.industryService.getIndustryList(null);
     /*    */ }
   /* 40 */ env.setVariable("list", ObjectWrapper.DEFAULT_WRAPPER.wrap(industryList));
   /* 41 */ body.render(env.getOut());
   /* 42 */ ViewTools.includePagination(site, params, env);
   /*    */ }
Пример #20
0
 @SuppressWarnings({"unchecked", "rawtypes"})
 public void execute(
     Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body)
     throws TemplateException, IOException {
   String s = DirectiveUtils.getString(PARAM_S, params);
   Integer len = DirectiveUtils.getInt(PARAM_LEN, params);
   String append = DirectiveUtils.getString(PARAM_APPEND, params);
   if (StringUtils.isNotBlank(s)) {
     Writer out = env.getOut();
     if (!Lang.isEmpty(len)) {
       out.append(StrUtils.htmlCut(s, len, append));
     } else {
       out.append(s);
     }
   }
 }
Пример #21
0
 @SuppressWarnings("unchecked")
 public void execute(
     Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body)
     throws TemplateException, IOException {
   String s = DirectiveUtils.getString(PARAM_S, params);
   Integer len = DirectiveUtils.getInt(PARAM_LEN, params);
   String append = DirectiveUtils.getString(PARAM_APPEND, params);
   if (s != null) {
     Writer out = env.getOut();
     if (len != null) {
       out.append(StrUtils.textCut(s, len, append));
     } else {
       out.append(s);
     }
   }
 }
  @SuppressWarnings("unchecked")
  public void execute(
      Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body)
      throws TemplateException, IOException {
    Integer siteId = getSiteId(params);
    if (siteId == null) {
      siteId = FrontUtils.getSite(env).getId();
    }
    List<CmsFriendlinkCtg> list = cmsFriendlinkCtgMng.getList(siteId);

    Map<String, TemplateModel> paramWrap = new HashMap<String, TemplateModel>(params);
    paramWrap.put(OUT_LIST, DEFAULT_WRAPPER.wrap(list));
    Map<String, TemplateModel> origMap = DirectiveUtils.addParamsToVariable(env, paramWrap);
    body.render(env.getOut());
    DirectiveUtils.removeParamsFromVariable(env, paramWrap, origMap);
  }
 /**
  * This method is declared by the <code>TemplateDirectiveModel</code> interface that the abstract
  * superclass <code>AbstractFreeMarkerDirective</code> implements. It retrieves any properties
  * supplied when invoking the directive and passes them onto the <code>PresentationService</code>
  * method.
  */
 @SuppressWarnings({"unchecked", "rawtypes"})
 public void execute(
     Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body)
     throws TemplateException, IOException {
   String name = getStringProperty(params, "name", false);
   String id = getStringProperty(params, "id", false);
   String protocol = getStringProperty(params, "protocol", false);
   String endpoint = getStringProperty(params, "endpoint", false);
   String objectId = getStringProperty(params, "object", false);
   String payload = getStringProperty(params, "payload", false);
   String url =
       getRenderService()
           .generateResourceURL(
               getRequestContext(), getObject(), name, id, protocol, endpoint, objectId, payload);
   env.getOut().write(url);
 }
Пример #24
0
  public void execute(
      Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body)
      throws TemplateException, IOException {

    // 获取参数
    // 站点id
    String siteid = getParam(params, "siteid");
    // 类型
    String type = getParam(params, "type");

    if (body != null) {
      // 设置循环变量
      if (loopVars != null && loopVars.length > 0) {

        java.text.SimpleDateFormat df = new java.text.SimpleDateFormat("yyyy-MM-dd");
        java.util.Calendar calendar = java.util.Calendar.getInstance();
        String today = df.format(calendar.getTime());
        calendar.roll(java.util.Calendar.DAY_OF_YEAR, -1);
        String yesterday = df.format(calendar.getTime());
        calendar.roll(java.util.Calendar.DAY_OF_YEAR, 1);
        if (calendar.get(java.util.Calendar.MONTH) == 0) {
          calendar.roll(java.util.Calendar.YEAR, -1);
        }
        calendar.roll(java.util.Calendar.MONTH, -1);
        String month = df.format(calendar.getTime());

        Visit visit = new Visit();
        visit.setSiteid(siteid);
        if ("today".equals(type)) {
          // 今天
          visit.setStarttime(DateUtil.parse(today, "yyyy-MM-dd"));
        } else if ("yesterday".equals(type)) {
          // 昨天
          visit.setStarttime(DateUtil.parse(yesterday, "yyyy-MM-dd"));
          visit.setEndtime(DateUtil.parse(today, "yyyy-MM-dd"));
        } else if ("month".equals(type)) {
          // 本月
          visit.setStarttime(DateUtil.parse(month, "yyyy-MM-dd"));
        }

        loopVars[0] =
            new SimpleNumber(
                visitService.count(visit, "true".equals(getParam(params, "cache")) ? true : false));
        body.render(env.getOut());
      }
    }
  }
  @SuppressWarnings("unchecked")
  public void execute(
      Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body)
      throws TemplateException, IOException {
    CmsSite site = FrontUtils.getSite(env);
    Integer parentId = DirectiveUtils.getInt(PARAM_PARENT_ID, params);
    Integer siteId = DirectiveUtils.getInt(PARAM_SITE_ID, params);
    boolean hasContentOnly = getHasContentOnly(params);

    Pagination page;
    if (parentId != null) {
      page =
          channelMng.getChildPageForTag(
              parentId, hasContentOnly, FrontUtils.getPageNo(env), FrontUtils.getCount(params));
    } else {
      if (siteId == null) {
        siteId = site.getId();
      }
      page =
          channelMng.getTopPageForTag(
              siteId, hasContentOnly, FrontUtils.getPageNo(env), FrontUtils.getCount(params));
    }

    Map<String, TemplateModel> paramWrap = new HashMap<String, TemplateModel>(params);
    paramWrap.put(OUT_PAGINATION, DEFAULT_WRAPPER.wrap(page));
    Map<String, TemplateModel> origMap = DirectiveUtils.addParamsToVariable(env, paramWrap);
    InvokeType type = DirectiveUtils.getInvokeType(params);
    String listStyle = DirectiveUtils.getString(PARAM_STYLE_LIST, params);
    if (InvokeType.sysDefined == type) {
      if (StringUtils.isBlank(listStyle)) {
        throw new ParamsRequiredException(PARAM_STYLE_LIST);
      }
      env.include(TPL_STYLE_LIST + listStyle + TPL_SUFFIX, UTF8, true);
    } else if (InvokeType.userDefined == type) {
      if (StringUtils.isBlank(listStyle)) {
        throw new ParamsRequiredException(PARAM_STYLE_LIST);
      }
      FrontUtils.includeTpl(TPL_STYLE_LIST, site, env);
    } else if (InvokeType.custom == type) {
      FrontUtils.includeTpl(TPL_NAME, site, params, env);
    } else if (InvokeType.body == type) {
      body.render(env.getOut());
    } else {
      throw new RuntimeException("invoke type not handled: " + type);
    }
    DirectiveUtils.removeParamsFromVariable(env, paramWrap, origMap);
  }
Пример #26
0
  @Override
  @SuppressWarnings("rawtypes")
  public void execute(
      Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body)
      throws TemplateException, IOException {

    Boolean active = getActiveValue(params);
    if (active == null) {
      super.execute(env, params, loopVars, body);
      return;
    }
    Object objectValue = getObjectValue(env, params);
    if (objectValue != null && objectValue instanceof PageOut) {
      PageOut page = (PageOut) objectValue;
      if (page.isActive().booleanValue() == active.booleanValue()) {
        body.render(env.getOut());
      }
    }
  }
Пример #27
0
  @SuppressWarnings("unchecked")
  public void execute(
      Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body)
      throws TemplateException, IOException {
    Integer id = getId(params);
    Boolean next = DirectiveUtils.getBool(PRAMA_NEXT, params);
    Content content;
    if (next == null) {
      content = contentMng.findById(id);
    } else {
      CmsSite site = FrontUtils.getSite(env);
      Integer channelId = DirectiveUtils.getInt(PARAM_CHANNEL_ID, params);
      content = contentMng.getSide(id, site.getId(), channelId, next);
    }

    Map<String, TemplateModel> paramWrap = new HashMap<String, TemplateModel>(params);
    paramWrap.put(OUT_BEAN, DEFAULT_WRAPPER.wrap(content));
    Map<String, TemplateModel> origMap = DirectiveUtils.addParamsToVariable(env, paramWrap);
    body.render(env.getOut());
    DirectiveUtils.removeParamsFromVariable(env, paramWrap, origMap);
  }
  @Override
  protected void doExecute(
      Environment env, Map<String, ?> params, TemplateModel[] loopVars, TemplateDirectiveBody body)
      throws TemplateException, IOException {
    // 接受参数
    String type =
        super.getStringValueByParams(params, TYPE_PARAM, ThumbType.THUMB_SOURCE.asType()); // 默认源文件
    String path =
        super.getStringValueByParams(params, PATH_PARAM, "resources/images/default.jpg"); // 默认源文件

    // 拼装文件
    String trueFileName = FilesHelper.insertStringForPath(path, type);
    String photoServerDomain = PropertiesUtils.getEntryValue("photoServer.domain");

    StringBuilder sb = new StringBuilder();
    sb.append(photoServerDomain).append(trueFileName);

    env.getOut().write(sb.toString());
    /*if(null!=body){
    	body.render(env.getOut());
    }*/
  }
  public void execute(
      Environment env,
      @SuppressWarnings("rawtypes") Map params,
      TemplateModel[] loopVars,
      TemplateDirectiveBody body)
      throws TemplateException, IOException {
    // Check if no parameters were given:
    if (!params.isEmpty()) {
      throw new TemplateModelException("This directive doesn't allow parameters.");
    }
    if (loopVars.length != 0) {
      throw new TemplateModelException("This directive doesn't allow loop variables.");
    }

    // If there is non-empty nested content:
    if (body != null) {
      // Executes the nested body. Same as <#nested> in FTL, except
      // that we use our own writer instead of the current output writer.
      body.render(new UpperCaseFilterWriter(env.getOut()));
    } else {
      throw new RuntimeException("missing body");
    }
  }
  @SuppressWarnings("unchecked")
  public void execute(
      Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body)
      throws TemplateException, IOException {
    String instantMessagingTypeString =
        DirectiveUtil.getStringParameter(INSTANT_MESSAGING_TYPE_PARAMETER_NAME, params);
    Integer count = DirectiveUtil.getIntegerParameter(COUNT_PARAMETER_NAME, params);

    InstantMessagingType instantMessagingType = null;
    if (StringUtils.isNotEmpty(instantMessagingTypeString)) {
      instantMessagingType = InstantMessagingType.valueOf(instantMessagingTypeString);
    }

    List<InstantMessaging> instantMessagingList =
        instantMessagingService.getInstantMessagingList(instantMessagingType, count);

    if (body != null && instantMessagingList != null) {
      if (loopVars.length > 0) {
        loopVars[0] = ObjectWrapper.BEANS_WRAPPER.wrap(instantMessagingList);
      }
      body.render(env.getOut());
    }
  }