Class AccessLogConfig.BuilderBase<BUILDER extends AccessLogConfig.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends AccessLogConfig>

java.lang.Object
io.helidon.webserver.accesslog.AccessLogConfig.BuilderBase<BUILDER,PROTOTYPE>
Type Parameters:
BUILDER - type of the builder extending this abstract builder
PROTOTYPE - type of the prototype interface that would be built by Prototype.Builder.buildPrototype()
All Implemented Interfaces:
Prototype.Builder<BUILDER,PROTOTYPE>, Prototype.ConfiguredBuilder<BUILDER,PROTOTYPE>
Direct Known Subclasses:
AccessLogConfig.Builder
Enclosing interface:
AccessLogConfig

public abstract static class AccessLogConfig.BuilderBase<BUILDER extends AccessLogConfig.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends AccessLogConfig> extends Object implements Prototype.ConfiguredBuilder<BUILDER,PROTOTYPE>
Fluent API builder base for AccessLogFeature.
  • Constructor Details

    • BuilderBase

      protected BuilderBase()
      Protected to support extensibility.
  • Method Details

    • from

      public BUILDER from(AccessLogConfig prototype)
      Update this builder from an existing prototype instance. This method disables automatic service discovery.
      Parameters:
      prototype - existing prototype to update this builder from
      Returns:
      updated builder instance
    • from

      public BUILDER from(AccessLogConfig.BuilderBase<?,?> builder)
      Update this builder from an existing prototype builder instance.
      Parameters:
      builder - existing builder prototype to update this builder from
      Returns:
      updated builder instance
    • defaultLogFormat

      public BUILDER defaultLogFormat()
      Use default log format.

      Clears the current log entries and replaces them with default log format.

      Helidon log format uses the following log entries (in this order):

      Returns:
      updated builder instance
    • commonLogFormat

      public BUILDER commonLogFormat()
      Use common log format.

      Clears the current log entries and replaces them with common log format.

      common log format uses the following log entries (in this order):

      Returns:
      updated builder instance
    • config

      public BUILDER config(Config config)
      Update builder from configuration (node of this type). If a value is present in configuration, it would override currently configured values.
      Specified by:
      config in interface Prototype.ConfiguredBuilder<BUILDER extends AccessLogConfig.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends AccessLogConfig>
      Parameters:
      config - configuration instance used to obtain values to update this builder
      Returns:
      updated builder instance
    • entries

      public BUILDER entries(List<? extends AccessLogEntry> entries)
      Configured log entries. If both entries and format() are defined, format() is used.
      Parameters:
      entries - list of access log entries
      Returns:
      updated builder instance
      See Also:
    • addEntries

      public BUILDER addEntries(List<? extends AccessLogEntry> entries)
      Configured log entries. If both entries and format() are defined, format() is used.
      Parameters:
      entries - list of access log entries
      Returns:
      updated builder instance
      See Also:
    • addEntry

      public BUILDER addEntry(AccessLogEntry entry)
      Configured log entries. If both entries and format() are defined, format() is used.
      Parameters:
      entry - list of access log entries
      Returns:
      updated builder instance
      See Also:
    • clock

      public BUILDER clock(Clock clock)
      Configure an alternative clock to use, such as Clock.fixed(java.time.Instant, java.time.ZoneId). Defaults to Clock.systemDefaultZone().
      Parameters:
      clock - clock to use to get current times
      Returns:
      updated builder instance
      See Also:
    • loggerName

      public BUILDER loggerName(String loggerName)
      Name of the logger used to obtain access log logger from System.getLogger(String). Defaults to "io.helidon.webserver.AccessLog".
      Parameters:
      loggerName - name of the logger to use
      Returns:
      updated builder instance
      See Also:
    • weight

      public BUILDER weight(double weight)
      Weight of the access log feature. We need to log access for anything happening on the server, so weight is high: 1000.0.
      Parameters:
      weight - weight of the feature
      Returns:
      updated builder instance
      See Also:
    • sockets

      public BUILDER sockets(Set<? extends String> sockets)
      List of sockets to register this feature on. If empty, it would get registered on all sockets. The logger used will have the expected logger with a suffix of the socket name.
      Parameters:
      sockets - socket names to register on, defaults to empty (all available sockets)
      Returns:
      updated builder instance
      See Also:
    • addSockets

      public BUILDER addSockets(Set<? extends String> sockets)
      List of sockets to register this feature on. If empty, it would get registered on all sockets. The logger used will have the expected logger with a suffix of the socket name.
      Parameters:
      sockets - socket names to register on, defaults to empty (all available sockets)
      Returns:
      updated builder instance
      See Also:
    • name

      public BUILDER name(String name)
      Name of this instance.
      Parameters:
      name - instance name
      Returns:
      updated builder instance
      See Also:
    • clearFormat

      public BUILDER clearFormat()
      Clear existing value of this property.
      Returns:
      updated builder instance
      See Also:
    • format

      public BUILDER format(String format)
      The format for log entries (similar to the Apache LogFormat).
      Log format elements
      %h IP address of the remote host HostLogEntry
      %l The client identity. This is always undefined in Helidon. UserIdLogEntry
      %u User ID as asserted by Helidon Security. UserLogEntry
      %t The timestamp TimestampLogEntry
      %r The request line ("GET /favicon.ico HTTP/1.0") RequestLineLogEntry
      %s The status code returned to the client StatusLogEntry
      %b The entity size in bytes SizeLogEntry
      %D The time taken in microseconds (start of request until last byte written) TimeTakenLogEntry
      %T The time taken in seconds (start of request until last byte written), integer TimeTakenLogEntry
      %{header-name}i Value of header header-name HeaderLogEntry
      Parameters:
      format - format string, such as %h %l %u %t %r %b %{Referer}i
      Returns:
      updated builder instance
      See Also:
    • enabled

      public BUILDER enabled(boolean enabled)
      Whether this feature will be enabled.
      Parameters:
      enabled - whether enabled
      Returns:
      updated builder instance
      See Also:
    • entries

      public List<AccessLogEntry> entries()
      Configured log entries. If both entries and format() are defined, format() is used.
      Returns:
      the entries
    • clock

      public Clock clock()
      Configure an alternative clock to use, such as Clock.fixed(java.time.Instant, java.time.ZoneId). Defaults to Clock.systemDefaultZone().
      Returns:
      the clock
    • loggerName

      public String loggerName()
      Name of the logger used to obtain access log logger from System.getLogger(String). Defaults to "io.helidon.webserver.AccessLog".
      Returns:
      the logger name
    • weight

      public double weight()
      Weight of the access log feature. We need to log access for anything happening on the server, so weight is high: 1000.0.
      Returns:
      the weight
    • sockets

      public Set<String> sockets()
      List of sockets to register this feature on. If empty, it would get registered on all sockets. The logger used will have the expected logger with a suffix of the socket name.
      Returns:
      the sockets
    • name

      public String name()
      Name of this instance.
      Returns:
      the name
    • format

      public Optional<String> format()
      The format for log entries (similar to the Apache LogFormat).
      Log format elements
      %h IP address of the remote host HostLogEntry
      %l The client identity. This is always undefined in Helidon. UserIdLogEntry
      %u User ID as asserted by Helidon Security. UserLogEntry
      %t The timestamp TimestampLogEntry
      %r The request line ("GET /favicon.ico HTTP/1.0") RequestLineLogEntry
      %s The status code returned to the client StatusLogEntry
      %b The entity size in bytes SizeLogEntry
      %D The time taken in microseconds (start of request until last byte written) TimeTakenLogEntry
      %T The time taken in seconds (start of request until last byte written), integer TimeTakenLogEntry
      %{header-name}i Value of header header-name HeaderLogEntry
      Returns:
      the format
    • enabled

      public boolean enabled()
      Whether this feature will be enabled.
      Returns:
      the enabled
    • config

      public Optional<Config> config()
      If this instance was configured, this would be the config instance used.
      Returns:
      config node used to configure this builder, or empty if not configured
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • preBuildPrototype

      protected void preBuildPrototype()
      Handles providers and decorators.
    • validatePrototype

      protected void validatePrototype()
      Validates required properties.