Package cn.bran.japid.template

Examples of cn.bran.japid.template.RenderResult


    public Foo2(StringBuilder out) {
      super(out);
    }

    public RenderResult render(List<String> lists) {
      return new RenderResult();
    }
View Full Code Here


    public Bar(StringBuilder out) {
      super(out);
    }
   
    public RenderResult render() {
      return new RenderResult();
    }
View Full Code Here

   * @param args
   *            arguments
   */
  public static <T extends JapidTemplateBaseWithoutPlay> void render(Class<T> c, Object... args) {
    try {
      RenderResult rr = invokeRender(c, args);
      throw new JapidResult(rr);
    } catch (Exception e) {
      if (e instanceof JapidResult)
        throw (JapidResult) e;
      // e.printStackTrace();
View Full Code Here

      // assuming second
      ttl += "s";
    }

    String base = StackTraceUtils.getCaller();
    RenderResult rr = getFromCache(base, objects);
    if (rr == null) {
      rr = runner.run();
      cache(rr, ttl, base, objects);
    }
    // System.out.println("render show took ms: " + rr.getRenderTime());
View Full Code Here

   * downstream of the pipeline
   *
   * @param r
   */
  protected static void render(CacheableRunner r) {
    RenderResult rr = r.run();
    throw new JapidResult(rr);
  }
View Full Code Here

   * @param s
   */
  protected static void renderText(String s) {
    Map<String, String> headers = new HashMap<String, String>();
    headers.put("Content-Type", "text/plain; charset=utf-8");
    render(new RenderResult(headers, new StringBuilder(s), -1L));
  }
View Full Code Here

  }
 
  public static void testCachedRenderResult() {
    CachedItemStatus cis = new CachedItemStatus(0);
    HashMap<String, String> headers = new HashMap<String, String>();
    RenderResult rr = new RenderResult(headers, new StringBuilder(), 123);
    CachedRenderResult crr = new CachedRenderResult(cis, rr);
    Cache.safeAdd("crr", crr, "10s");
    crr = (CachedRenderResult) Cache.get("crr");
    if(crr.isExpired())
      renderText("good to know..");
View Full Code Here

      renderText("StringBuilder does not works...");
  }
 
  public static void testRenderResult() {
    HashMap<String, String> headers = null; //new HashMap<String, String>();
    RenderResult rr = new RenderResult(headers, new StringBuilder(), 123);
//    RenderResult rr = new RenderResult(headers, null, 123);
    Cache.safeAdd("crr", rr, "10s");
    rr = (RenderResult) Cache.get("crr");
    if (rr != null)
      renderText("good to know 2...");
View Full Code Here

 
 
  public static void foo() {
    StringBuilder sb = new StringBuilder();
    sb.append("--------------foo() action invoked:Hello foo!");
    RenderResult rr = new RenderResult(null, sb, 0);
   
    throw new JapidResult(rr);
   
//    runWithCache(new ActionRunner() {
//      @Override
View Full Code Here

          throw new RuntimeException("Japid Emailer: could not find a Japid template with the name of: " + templateFileName);
        } else {
          try {
          JapidController2.render(tClass, args);
        } catch (JapidResult jr) {
          RenderResult rr = jr.getRenderResult();
          bodyHtml = rr.getContent().toString();
        }
        }

            // Recipients
            final List<Object> recipientList = (List<Object>) infoMap.get(RECIPIENTS);
View Full Code Here

TOP

Related Classes of cn.bran.japid.template.RenderResult

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.