Ejemplo n.º 1
0
 @Override
 public Continuation<SanitizedContent> renderStrict() {
   enforceContentKind();
   AdvisingStringBuilder buf = new AdvisingStringBuilder();
   try {
     return Continuations.strictContinuation(startRender(buf), buf, expectedContentKind);
   } catch (IOException e) {
     throw new AssertionError("impossible", e);
   }
 }
Ejemplo n.º 2
0
 @Override
 public Continuation<String> render() {
   if (contentKindExplicitlySet || contentKind.isPresent()) {
     enforceContentKind();
   }
   AdvisingStringBuilder buf = new AdvisingStringBuilder();
   try {
     return Continuations.stringContinuation(startRender(buf), buf);
   } catch (IOException e) {
     throw new AssertionError("impossible", e);
   }
 }
Ejemplo n.º 3
0
 private static WriteContinuation doRender(
     CompiledTemplate template, Scoper scoper, AdvisingAppendable out, RenderContext context)
     throws IOException {
   RenderResult result;
   try (WithScope scope = scoper.enter()) {
     result = template.render(out, context);
   } catch (Throwable t) {
     rewriteStackTrace(t);
     Throwables.propagateIfInstanceOf(t, IOException.class);
     throw Throwables.propagate(t);
   }
   if (result.isDone()) {
     return Continuations.done();
   }
   return new WriteContinuationImpl(result, scoper, context, out, template);
 }