Examples of StreamingOutput


Examples of javax.ws.rs.core.StreamingOutput

    @GET
    @Produces("text/html")
    public StreamingOutput getListAsHtml() {
        final EmployeeList employees = getEmployees();
        return new StreamingOutput() {
            public void write(OutputStream output) throws IOException {
                final PrintStream ps = new PrintStream(output);
                ps.println("<html><head>");
                ps.println("<title>Employees</title>");
                ps.println("</head></body>");
View Full Code Here

Examples of javax.ws.rs.core.StreamingOutput

    @GET
    @Produces("text/html")
    public StreamingOutput getHtml(@Context final UriInfo uriInfo) {
        final Employee employee = get(uriInfo);
        final URI employeesUri = createEmployeesUri(uriInfo);
        return new StreamingOutput() {
            public void write(OutputStream output) throws IOException {
                final PrintStream ps = new PrintStream(output);
                ps.println("<html><head>");
                ps.println("<title>Employee</title>");
                ps.println("</head></body>");
View Full Code Here

Examples of javax.ws.rs.core.StreamingOutput

                } else {
                    throw new UnsupportedOperationException();
                }
            }

            StreamingOutput stream = fs.open(found, from, to);

            if (from != null || to != null) {
                response = Response.status(206);

                long rangeStart = 0;
View Full Code Here

Examples of javax.ws.rs.core.StreamingOutput

      final Customer customer = customerDB.get(id);
      if (customer == null)
      {
         throw new WebApplicationException(Response.Status.NOT_FOUND);
      }
      return new StreamingOutput()
      {
         public void write(OutputStream outputStream) throws IOException, WebApplicationException
         {
            outputCustomer(outputStream, customer);
         }
View Full Code Here

Examples of javax.ws.rs.core.StreamingOutput

      if (found == null)
      {
         throw new WebApplicationException(Response.Status.NOT_FOUND);
      }
      final Customer customer = found;
      return new StreamingOutput()
      {
         public void write(OutputStream outputStream) throws IOException, WebApplicationException
         {
            outputCustomer(outputStream, customer);
         }
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(namenode, fullpath);
      return Response.ok(streaming).type(MediaType.APPLICATION_JSON).build();
    }
    case GETCONTENTSUMMARY:
    {
      final ContentSummary contentsummary = namenode.getContentSummary(fullpath);
View Full Code Here

Examples of javax.ws.rs.core.StreamingOutput

  private static StreamingOutput getListingStream(final NameNode 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

  @POST
  @Path("/zip")
  @Consumes(MediaType.APPLICATION_JSON)
  @Produces(MediaType.APPLICATION_OCTET_STREAM)
  public Response downloadGZip(final DownloadRequest request) {
    StreamingOutput result = new StreamingOutput() {
      public void write(OutputStream output) throws IOException,
          WebApplicationException {
        ZipOutputStream zip = new ZipOutputStream(output);
        try {
          HdfsApi api = getApi(context);
View Full Code Here

Examples of javax.ws.rs.core.StreamingOutput

  @POST
  @Path("/concat")
  @Consumes(MediaType.APPLICATION_JSON)
  @Produces(MediaType.APPLICATION_OCTET_STREAM)
  public Response concat(final DownloadRequest request) {
    StreamingOutput result = new StreamingOutput() {
      public void write(OutputStream output) throws IOException,
          WebApplicationException {
        FSDataInputStream in = null;
        for (String path : request.entries) {
          try {
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
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.