Package juzu.io

Examples of juzu.io.Streamable


    //
    if (request.getPhase() == Phase.VIEW) {
      if (result instanceof Response.Content) {
        Response.Status status = (Response.Status)result;
        final Streamable wrapped = status.streamable();
        Streamable wrapper = new Streamable() {
          public void send(final Stream stream) throws IllegalStateException {
            Stream our = new Stream() {
              boolean done = false;
              public void provide(Chunk chunk) {
                if (chunk instanceof Chunk.Data && !done) {
View Full Code Here


          }
          return resp;
        } else if (ret != null && mimeType != null) {
          for (EntityMarshaller writer : Tools.loadService(EntityMarshaller.class, request.controllerPlugin.getApplication().getClassLoader())) {
            for (String s : mimeType.value()) {
              Streamable streamable = writer.marshall(s, context.getHandler().getMethod(), ret);
              if (streamable != null) {
                return Response.ok().with(PropertyType.MIME_TYPE, s).body(streamable);
              }
            }
          }
View Full Code Here

    public <T> Status with(PropertyType<T> propertyType, T propertyValue) throws NullPointerException {
      return (Status)super.with(propertyType, propertyValue);
    }

    public Streamable streamable() {
      return new Streamable() {
        public void send(Stream stream) throws IllegalStateException {

          // Send properties
          for (PropertyType<?> propertyType : properties) {
            Iterable<?> values = properties.getValues(propertyType);
View Full Code Here

        data = null;
      }

      //
      if (data != null) {
        return new Streamable() {
          @Override
          public void send(Stream stream) throws IllegalStateException {
            try {
              stream.provide(Chunk.create(data));
            }
View Full Code Here

TOP

Related Classes of juzu.io.Streamable

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.