Package io.helidon.webserver.accesslog
Class AbstractLogEntry
- java.lang.Object
-
- io.helidon.webserver.accesslog.AbstractLogEntry
-
- All Implemented Interfaces:
AccessLogEntry
,Handler
,BiConsumer<ServerRequest,ServerResponse>
- Direct Known Subclasses:
HeaderLogEntry
,HostLogEntry
,RequestLineLogEntry
,SizeLogEntry
,StatusLogEntry
,TimestampLogEntry
,TimeTakenLogEntry
,UserLogEntry
public abstract class AbstractLogEntry extends Object implements AccessLogEntry
Common log entry features.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
AbstractLogEntry.Builder<R extends AbstractLogEntry,T extends AbstractLogEntry.Builder<R,?>>
A fluent API builder forAbstractLogEntry
.-
Nested classes/interfaces inherited from interface io.helidon.webserver.Handler
Handler.EntityHandler<T>
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_MAX_LENGTH
Default limit for the number of characters written.-
Fields inherited from interface io.helidon.webserver.accesslog.AccessLogEntry
NOT_AVAILABLE
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractLogEntry(AbstractLogEntry.Builder<?,?> builder)
Create a new instance using a builder.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description String
apply(AccessLogContext context)
Apply the log entry, adds padding to the log entry and then callsdoApply(AccessLogContext)
.protected abstract String
doApply(AccessLogContext context)
Apply the "raw" log entry.protected String
maxLength(String toLimit)
Apply maximal length limitation.protected String
pad(String toPad)
Apply configured padding.protected String
sanitize(String toSanitize)
Apply configured sanitization.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.helidon.webserver.accesslog.AccessLogEntry
accept
-
Methods inherited from interface java.util.function.BiConsumer
andThen
-
-
-
-
Field Detail
-
DEFAULT_MAX_LENGTH
public static final int DEFAULT_MAX_LENGTH
Default limit for the number of characters written.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AbstractLogEntry
protected AbstractLogEntry(AbstractLogEntry.Builder<?,?> builder)
Create a new instance using a builder.- Parameters:
builder
- builder that extendsAbstractLogEntry.Builder
-
-
Method Detail
-
apply
public String apply(AccessLogContext context)
Apply the log entry, adds padding to the log entry and then callsdoApply(AccessLogContext)
.- Specified by:
apply
in interfaceAccessLogEntry
- Parameters:
context
- context with access to information useful for access log entries- Returns:
- formatted log entry
-
maxLength
protected String maxLength(String toLimit)
Apply maximal length limitation.- Parameters:
toLimit
- sanitized string- Returns:
- shortened string
-
sanitize
protected String sanitize(String toSanitize)
Apply configured sanitization.- Parameters:
toSanitize
- string to sanitize- Returns:
- sanitized string
-
pad
protected String pad(String toPad)
Apply configured padding.- Parameters:
toPad
- string to pad- Returns:
- padded string
-
doApply
protected abstract String doApply(AccessLogContext context)
Apply the "raw" log entry. The result will go through common formatting, such as padding if configured.- Parameters:
context
- context with access to information useful for access log entries- Returns:
- log entry
- See Also:
AccessLogEntry.NOT_AVAILABLE
-
-