Package javax.ws.rs.core

Examples of javax.ws.rs.core.StreamingOutput


    doReturn( true ).when( mockAuthPolicy ).isAllowed( anyString() );

    BaseExportProcessor mockExportProcessor = mock( BaseExportProcessor.class );
    File mockExportFile = mock( File.class );
    ExportHandler mockExportHandler = mock( ExportHandler.class );
    StreamingOutput mockStream = mock( StreamingOutput.class );

    RepositoryFile mockRepoFile = mock( RepositoryFile.class );
    doReturn( fileName ).when( mockRepoFile ).getName();
    doReturn( mockExportFile ).when( mockExportProcessor ).performExport( mockRepoFile );
View Full Code Here


            )
        );

        return Response
            .ok(
                new StreamingOutput()
                {
                  @Override
                  public void write(OutputStream outputStream) throws IOException, WebApplicationException
                  {
                    // json serializer will always close the yielder
View Full Code Here

      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

  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

        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

        // help with uniquely identifying incoming requests in logs.
        final UUID requestIdentifier = UUID.randomUUID();
        final String verticesInSplit = end == Long.MAX_VALUE ? "END" : String.valueOf(end - start);
        logger.debug(String.format("Request [%s] split between [%s] and [%s].", requestIdentifier, start, end));

        return new ExtensionResponse(Response.ok(new StreamingOutput() {
            @Override
            public void write(OutputStream out) throws IOException {
                long counter = 0;
                long vertexCount = 0;
View Full Code Here

      throw new WebApplicationException(Response.Status.NOT_FOUND);
    }
   
    final InputStream is = TikaInputStream.get(url, metadata);

    return new StreamingOutput() {
      public void write(OutputStream outputStream) throws IOException,
          WebApplicationException {

        StringWriter textBuffer = new StringWriter();
        ContentHandler handler = null;
View Full Code Here

    final ParseContext context = new ParseContext();
    context.set(Parser.class, parser);
    final org.apache.tika.metadata.Metadata metadata = new org.apache.tika.metadata.Metadata();
    setMetadataFromHeader(parser, metadata, httpHeaders);

    return new StreamingOutput() {
      public void write(OutputStream outputStream) throws IOException,
          WebApplicationException {

        StringWriter textBuffer = new StringWriter();
View Full Code Here

        msgNode.put("causes", causesToJson(mainThrowable));
        msgNode.put("stackTrace", formatStackTrace(mainThrowable));
    }

    public static Response jsonToResponse(int status, final ObjectNode msgNode) {
        StreamingOutput entity = new StreamingOutput() {
            @Override
            public void write(OutputStream output) throws IOException, WebApplicationException {
                JsonFormat.serialize(msgNode, output);
            }
        };
View Full Code Here

      final int b = bufferSize.getValue(conf);
      final DFSDataInputStream in = new DFSClient.DFSDataInputStream(
          dfsclient.open(fullpath, b, true, null));
      in.seek(offset.getValue());

      final StreamingOutput streaming = new StreamingOutput() {
        @Override
        public void write(final OutputStream out) throws IOException {
          final Long n = length.getValue();
          if (n == null) {
            IOUtils.copyBytes(in, out, b);
View Full Code Here

TOP

Related Classes of javax.ws.rs.core.StreamingOutput

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.