Package juzu.io

Examples of juzu.io.ChunkBuffer


    public Content content(byte[] s) {
      return content(new ChunkBuffer().append(Chunk.create(s)).close());
    }

    public Content content(java.io.InputStream s) {
      return content(new ChunkBuffer().append(Chunk.create(s)).close());
    }
View Full Code Here


  public Response.Content index() throws IOException {
    final Request request = Request.getCurrent();
    final ScopeController controller = request.getScopeController();
    AbstractRunnableAsyncTestCase.requestURL = "" + A_.index();
    AbstractRunnableAsyncTestCase.requestDestroyed = AbstractRunnableAsyncTestCase.destroyed.get();
    final ChunkBuffer content = new ChunkBuffer();
    Runnable task = new Runnable() {
      public void run() {
        ContextLifeCycle lf = request.suspend();
        try {
          Thread.sleep(500);
          AbstractRunnableAsyncTestCase.runnableURL = "" + A_.index();
          AbstractRunnableAsyncTestCase.runnableDestroyed = AbstractRunnableAsyncTestCase.destroyed.get();
          AbstractRunnableAsyncTestCase.runnableActive = controller.isActive();
          content.append(Chunk.create("pass"));
        }
        catch (Exception e) {
          e.printStackTrace();
        } finally {
          lf.resume();
          content.close();
        }
      }
    };
    context.getExecutor().execute(task);
    return Response.content(200, content);
View Full Code Here

  @Resource
  @Route("/")
  public Response.Content index() throws IOException {
    AbstractRunnableContextualAsyncTestCase.requestURL = "" + A_.index();
    AbstractRunnableContextualAsyncTestCase.requestDestroyed = AbstractRunnableContextualAsyncTestCase.destroyed.get();
    final ChunkBuffer content = new ChunkBuffer();
    Runnable task = new Runnable() {
      public void run() {
        try {
          Thread.sleep(500);
          AbstractRunnableContextualAsyncTestCase.runnableURL = "" + A_.index();
          AbstractRunnableContextualAsyncTestCase.runnableDestroyed = AbstractRunnableContextualAsyncTestCase.destroyed.get();
          AbstractRunnableContextualAsyncTestCase.runnableActive = Request.getCurrent().getScopeController().isActive();
          content.append(Chunk.create("pass"));
        }
        catch (Exception e) {
          e.printStackTrace();
        } finally {
          content.close();
        }
      }
    };
    context.getExecutor().execute(task);
    return Response.content(200, content);
View Full Code Here

  @View
  public Response.Content index() throws IOException {
    AbstractRunnableContextualAsyncTestCase.requestURL = "" + A_.index();
    AbstractRunnableContextualAsyncTestCase.requestDestroyed = AbstractRunnableContextualAsyncTestCase.destroyed.get();
    final ChunkBuffer content = new ChunkBuffer();
    Runnable task = new Runnable() {
      public void run() {
        try {
          Thread.sleep(500);
          AbstractRunnableContextualAsyncTestCase.runnableURL = "" + A_.index();
          AbstractRunnableContextualAsyncTestCase.runnableDestroyed = AbstractRunnableContextualAsyncTestCase.destroyed.get();
          AbstractRunnableContextualAsyncTestCase.runnableActive = Request.getCurrent().getScopeController().isActive();
          content.append(Chunk.create("pass"));
        }
        catch (Exception e) {
          e.printStackTrace();
        } finally {
          content.close();
        }
      }
    };
    context.getExecutor().execute(task);
    return Response.content(200, content);
View Full Code Here

     */
    public final Response.Content status(int status) throws UndeclaredIOException {
      StringBuilder sb = new StringBuilder();
      PropertyMap properties = new PropertyMap();
      doRender(properties, sb);
      ChunkBuffer buffer = new ChunkBuffer().append(Chunk.create(sb)).close();
      return new Response.Content(status, properties, buffer);
    }
View Full Code Here

TOP

Related Classes of juzu.io.ChunkBuffer

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.