Package com.google.sitebricks

Examples of com.google.sitebricks.StringBuilderRespond$HtmlBuilder


  public RequireWidget(XmlWidget child) throws ExpressionCompileException {
    this.widget = child;
  }

  public void render(Object bound, Respond respond) {
    StringBuilderRespond inner = new StringBuilderRespond(bound);
    widget.render(bound, inner);

    //special method interns tokens
    respond.require(inner.toString());
  }
View Full Code Here


    } else {
      compiled = templates.get(clazz);
    }
    Preconditions.checkArgument(null != compiled, "No template found attached to: %s", clazz);

    StringBuilderRespond respond = new StringBuilderRespond(context);
    //noinspection ConstantConditions
    compiled.render(context, respond);

    return respond.toString();
  }
View Full Code Here

      // get the extension page by name
      PageBook.Page page = book.forName(DecorateWidget.embedNameFor(templateClass));

      // create a dummy respond to collect the output of the embedded page
      StringBuilderRespond sbrespond = new StringBuilderRespond(bound);
      EmbeddedRespond embedded = new EmbeddedRespond(null, sbrespond);
      page.widget().render(bound, embedded);

      // write the head and content to the real respond
      respond.writeToHead(embedded.toHeadString());
View Full Code Here

        Set<? extends ConstraintViolation<?>> scv = (Set<? extends ConstraintViolation<?>>) cve.getConstraintViolations();
        errors = validationConvertor.to(scv);
    }
       
    //render to respond
    Respond respond = new StringBuilderRespond(instance);
    respond.setErrors(errors);
    if (null != redirect) {

      if (redirect instanceof String)
        respond.redirect((String) redirect);
      else if (redirect instanceof Class) {
        PageBook.Page targetPage = book.forClass((Class<?>) redirect);

        // should never be null coz it is validated on compile.
        respond.redirect(contextualize(request, targetPage.getUri()));
      } else if (redirect instanceof Reply<?>) {
        // To allow non-headless pages to use Reply<?> for more advanced HTTP responses
        return redirect;
      } else {
        // Handle page-chaining driven redirection.
        PageBook.Page targetPage = book.forInstance(redirect);

        // should never be null coz it will be validated at compile time.
        flashCacheProvider.get().put(targetPage.getUri(), targetPage);

        // Send to the canonical address of the page. This is also
        // verified at compile, not be a variablized matcher.
        respond.redirect(contextualize(request, targetPage.getUri()));
      }
    } else {
      page.widget().render(instance, respond);
    }
   
View Full Code Here

     
      // get the extension page by name
      PageBook.Page page = book.forName(DecorateWidget.embedNameFor(templateClass));
 
      // create a dummy respond to collect the output of the embedded page
      StringBuilderRespond sbrespond = new StringBuilderRespond();
      EmbeddedRespond embedded = new EmbeddedRespond(null, sbrespond);
      page.widget().render(bound, embedded);
 
      // write the head and content to the real respond
      respond.writeToHead(embedded.toHeadString());
View Full Code Here

    } else {
      compiled = templates.get(clazz);
    }
    Preconditions.checkArgument(null != compiled, "No template found attached to: %s", clazz);

    StringBuilderRespond respond = new StringBuilderRespond();
    //noinspection ConstantConditions
    compiled.render(context, respond);

    return respond.toString();
  }
View Full Code Here

TOP

Related Classes of com.google.sitebricks.StringBuilderRespond$HtmlBuilder

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.