Class LogViewerResource
- java.lang.Object
-
- org.glassfish.admin.rest.resources.custom.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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static interfaceLogViewerResource.SourceRepresents the data source of this text.protected static classLogViewerResource.TailMarkPoints to the end of the region.
-
Constructor Summary
Constructors Constructor Description LogViewerResource()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description jakarta.ws.rs.core.Responseget(long start, String instanceName, jakarta.ws.rs.core.HttpHeaders hh)StructuredLogViewerResourcegetDomainUptimeResource()voidinitLargeText(File file, boolean completed)voidinitLargeText(File file, Charset charset, boolean completed)booleanisComplete()voidmarkAsComplete()voidsetEntity(Dom p)protected longwriteLogTo(long start, OutputStream os)Writes the tail portion of the file to theOutputStream.protected longwriteLogTo(long start, Writer w)
-
-
-
Field Detail
-
injector
@Context protected org.glassfish.hk2.api.ServiceLocator injector
-
ui
@Context protected jakarta.ws.rs.core.UriInfo ui
-
habitat
@Context protected LocatorBridge habitat
-
charset
protected Charset charset
-
completed
protected volatile boolean completed
-
-
Method Detail
-
setEntity
public void setEntity(Dom p)
-
getDomainUptimeResource
@Path("details/") public StructuredLogViewerResource getDomainUptimeResource()
-
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)
-
markAsComplete
public void markAsComplete()
-
isComplete
public boolean isComplete()
-
writeLogTo
protected long writeLogTo(long start, Writer w) throws IOException- Throws:
IOException
-
writeLogTo
protected long writeLogTo(long start, OutputStream os) throws IOExceptionWrites the tail portion of the file to theOutputStream.- 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
-
-