Class LogViewerResource

  • Direct Known Subclasses:
    NotificationLogViewer

    public class LogViewerResource
    extends Object
    Represents a large text data.

    This class defines methods for handling progressive text update.

    Usage

    Author:
    Kohsuke Kawaguchi
    • Field Detail

      • injector

        @Context
        protected org.glassfish.hk2.api.ServiceLocator injector
      • ui

        @Context
        protected jakarta.ws.rs.core.UriInfo ui
      • charset

        protected Charset charset
      • completed

        protected volatile boolean completed
    • Constructor Detail

      • LogViewerResource

        public LogViewerResource()
    • Method Detail

      • setEntity

        public void setEntity​(Dom p)
      • get

        @GET
        @Produces("text/plain;charset=UTF-8")
        public jakarta.ws.rs.core.Response get​(@QueryParam("start") @DefaultValue("0")
                                               long start,
                                               @QueryParam("instanceName") @DefaultValue("server")
                                               String instanceName,
                                               @Context
                                               jakarta.ws.rs.core.HttpHeaders hh)
                                        throws IOException
        Throws:
        IOException
      • initLargeText

        public void initLargeText​(File file,
                                  boolean completed)
      • initLargeText

        public void initLargeText​(File file,
                                  Charset charset,
                                  boolean completed)
      • markAsComplete

        public void markAsComplete()
      • isComplete

        public boolean isComplete()
      • writeLogTo

        protected long writeLogTo​(long start,
                                  OutputStream os)
                           throws IOException
        Writes the tail portion of the file to the OutputStream.
        Parameters:
        start - The byte offset in the input file where the write operation starts.
        Returns:
        if the file is still being written, this method writes the file until the last newline character and returns the offset to start the next write operation.
        Throws:
        IOException