Record Class FileResourceConfig

java.lang.Object
java.lang.Record
com.inductiveautomation.ignition.common.fileresources.FileResourceConfig

public record FileResourceConfig(boolean httpEnabled, boolean requireHttps, boolean gzip, @Nullable String mimeTypeOverride, @NonNull com.google.common.collect.ImmutableMap<String,String> headers, @NonNull PermissionsConfig requiredPermissions) extends Record
Per-resource HTTP exposure configuration for a file resource. See RFC-31.

When httpEnabled is false (the default), the resource is invisible to the public-facing servlet (any request returns 404). When true, the remaining fields control how the resource is served.

headers are arbitrary static response headers applied to every response. A small set of headers managed by the servlet itself (Content-Type, Content-Encoding, Content-Length, ETag, Accept-Ranges, Content-Range) cannot be overridden via this map; attempts to do so are dropped at serving time. Mime-type changes go through mimeTypeOverride instead.

  • Constructor Summary

    Constructors
    Constructor
    Description
    FileResourceConfig(boolean httpEnabled, boolean requireHttps, boolean gzip, @Nullable String mimeTypeOverride, @NonNull com.google.common.collect.ImmutableMap<String,String> headers, @NonNull PermissionsConfig requiredPermissions)
    Creates an instance of a FileResourceConfig record class.
  • Method Summary

    Modifier and Type
    Method
    Description
     
    final boolean
    Indicates whether some other object is "equal to" this one.
    fromJsonTree(@Nullable com.inductiveautomation.ignition.common.gson.JsonElement json)
     
    boolean
    Returns the value of the gzip record component.
    final int
    Returns a hash code value for this object.
    @NonNull com.google.common.collect.ImmutableMap<String,String>
    Returns the value of the headers record component.
    boolean
    Returns the value of the httpEnabled record component.
    @Nullable String
    Returns the value of the mimeTypeOverride record component.
    Returns the value of the requiredPermissions record component.
    boolean
    Returns the value of the requireHttps record component.
    com.inductiveautomation.ignition.common.gson.JsonElement
     
    final String
    Returns a string representation of this record class.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • FileResourceConfig

      public FileResourceConfig(boolean httpEnabled, boolean requireHttps, boolean gzip, @Nullable String mimeTypeOverride, @NonNull com.google.common.collect.ImmutableMap<String,String> headers, @NonNull PermissionsConfig requiredPermissions)
      Creates an instance of a FileResourceConfig record class.
      Parameters:
      httpEnabled - the value for the httpEnabled record component
      requireHttps - the value for the requireHttps record component
      gzip - the value for the gzip record component
      mimeTypeOverride - the value for the mimeTypeOverride record component
      headers - the value for the headers record component
      requiredPermissions - the value for the requiredPermissions record component
  • Method Details

    • defaults

      public static FileResourceConfig defaults()
      Returns:
      a config with all features disabled. The resource is not exposed via HTTP.
    • toJsonTree

      public com.inductiveautomation.ignition.common.gson.JsonElement toJsonTree()
    • fromJsonTree

      public static FileResourceConfig fromJsonTree(@Nullable com.inductiveautomation.ignition.common.gson.JsonElement json)
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • httpEnabled

      public boolean httpEnabled()
      Returns the value of the httpEnabled record component.
      Returns:
      the value of the httpEnabled record component
    • requireHttps

      public boolean requireHttps()
      Returns the value of the requireHttps record component.
      Returns:
      the value of the requireHttps record component
    • gzip

      public boolean gzip()
      Returns the value of the gzip record component.
      Returns:
      the value of the gzip record component
    • mimeTypeOverride

      public @Nullable String mimeTypeOverride()
      Returns the value of the mimeTypeOverride record component.
      Returns:
      the value of the mimeTypeOverride record component
    • headers

      public @NonNull com.google.common.collect.ImmutableMap<String,String> headers()
      Returns the value of the headers record component.
      Returns:
      the value of the headers record component
    • requiredPermissions

      public @NonNull PermissionsConfig requiredPermissions()
      Returns the value of the requiredPermissions record component.
      Returns:
      the value of the requiredPermissions record component