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 interface
LogViewerResource.Source
Represents the data source of this text.protected static class
LogViewerResource.TailMark
Points 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.Response
get(long start, String instanceName, jakarta.ws.rs.core.HttpHeaders hh)
StructuredLogViewerResource
getDomainUptimeResource()
void
initLargeText(File file, boolean completed)
void
initLargeText(File file, Charset charset, boolean completed)
boolean
isComplete()
void
markAsComplete()
void
setEntity(Dom p)
protected long
writeLogTo(long start, OutputStream os)
Writes the tail portion of the file to theOutputStream
.protected long
writeLogTo(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 IOException
Writes 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
-
-