Examples of StreamingOutput


Examples of javax.ws.rs.core.StreamingOutput

    fillMetadata(parser, metadata, httpHeaders);

    logRequest(logger, info, metadata);

    return new StreamingOutput() {
      public void write(OutputStream outputStream)
        throws IOException, WebApplicationException {
        Writer writer = new OutputStreamWriter(outputStream, "UTF-8");
        ContentHandler content;
View Full Code Here

Examples of javax.ws.rs.core.StreamingOutput

    TikaResource.fillMetadata(parser, metadata, httpHeaders);
    TikaResource.logRequest(logger, info, metadata);

    parser.parse(is, new DefaultHandler(), metadata);

    return new StreamingOutput() {
      public void write(OutputStream outputStream) throws IOException, WebApplicationException {
        metadataToCsv(metadata, outputStream);
      }
    };
  }
View Full Code Here

Examples of javax.ws.rs.core.StreamingOutput

      final String js = JsonUtil.toJsonString(status, true);
      return Response.ok(js).type(MediaType.APPLICATION_JSON).build();
    }
    case LISTSTATUS:
    {
      final StreamingOutput streaming = getListingStream(np, fullpath);
      return Response.ok(streaming).type(MediaType.APPLICATION_JSON).build();
    }
    case GETCONTENTSUMMARY:
    {
      final ContentSummary contentsummary = np.getContentSummary(fullpath);
View Full Code Here

Examples of javax.ws.rs.core.StreamingOutput

  private static StreamingOutput getListingStream(final NamenodeProtocols np,
      final String p) throws IOException {
    final DirectoryListing first = getDirectoryListing(np, p,
        HdfsFileStatus.EMPTY_NAME);

    return new StreamingOutput() {
      @Override
      public void write(final OutputStream outstream) throws IOException {
        final PrintStream out = new PrintStream(outstream);
        out.println("{\"" + FileStatus.class.getSimpleName() + "es\":{\""
            + FileStatus.class.getSimpleName() + "\":[");
View Full Code Here

Examples of javax.ws.rs.core.StreamingOutput

        } catch ( IllegalAccessException e ) {
          throw new FileSystemException( FAILED_TO_ACCESS_REPOSITORY );
        }
      }
      throwExceptionOnBadResponse( response );
      StreamingOutput output = (StreamingOutput) response.getEntity();
      ByteArrayOutputStream stream = new ByteArrayOutputStream();
      output.write( stream );
      return stream.toByteArray();
    } catch ( FileNotFoundException e ) {
      throw new FileSystemException( FILE_NOT_FOUND, fullName );
    } catch ( IOException e ) {
      throw new FileSystemException( FAILED_TO_WRITE_FILE, fullName );
View Full Code Here

Examples of javax.ws.rs.core.StreamingOutput

    try {
      final OfflineDownloadResponse response = downloadResponseFetcher
          .fetch(email, filename);
      return Response
          .ok(new StreamingOutput() {
            @Override
            public void write(OutputStream output)
                throws IOException, WebApplicationException {
              IOUtils.copy(response.getBlob().openInputStream(),
                  output);
View Full Code Here

Examples of javax.ws.rs.core.StreamingOutput

      throw new NotFoundException();
    }
  }

  private StreamingOutput wrapByteArrayAsStreamingOutput(final byte[] bytes) {
    return new StreamingOutput() {
      public void write(OutputStream output) throws IOException,
          WebApplicationException {
        output.write(bytes);
      }
    };
View Full Code Here

Examples of javax.ws.rs.core.StreamingOutput

      final String js = JsonUtil.toJsonString(status, true);
      return Response.ok(js).type(MediaType.APPLICATION_JSON).build();
    }
    case LISTSTATUS:
    {
      final StreamingOutput streaming = getListingStream(np, fullpath);
      return Response.ok(streaming).type(MediaType.APPLICATION_JSON).build();
    }
    case GETCONTENTSUMMARY:
    {
      final ContentSummary contentsummary = np.getContentSummary(fullpath);
View Full Code Here

Examples of javax.ws.rs.core.StreamingOutput

        HdfsFileStatus.EMPTY_NAME);

    // must save ugi because the streaming object will be executed outside
    // the remote user's ugi
    final UserGroupInformation ugi = UserGroupInformation.getCurrentUser();
    return new StreamingOutput() {
      @Override
      public void write(final OutputStream outstream) throws IOException {
        final PrintWriter out = new PrintWriter(new OutputStreamWriter(
            outstream, Charsets.UTF_8));
        out.println("{\"" + FileStatus.class.getSimpleName() + "es\":{\""
View Full Code Here

Examples of javax.ws.rs.core.StreamingOutput

        IOUtils.cleanup(LOG, in);
        IOUtils.cleanup(LOG, dfsclient);
        throw ioe;
      }
      final DFSDataInputStream dis = in;
      final StreamingOutput streaming = new StreamingOutput() {
        @Override
        public void write(final OutputStream out) throws IOException {
          final Long n = length.getValue();
          DFSDataInputStream dfsin = dis;
          DFSClient client = dfsclient;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.