Class Constants

java.lang.Object
com.renomad.minum.state.Constants

public final class Constants extends Object
Very important system design decisions are made here. All developers on this project should look through each of these.
  • Field Details

    • serverPort

      public final int serverPort
      The port for our regular, non-encrypted server
    • secureServerPort

      public final int secureServerPort
      The port for our encrypted server
    • hostName

      public final String hostName
      This is returned as the "host:" attribute in an HTTP request
    • dbDirectory

      public final String dbDirectory
      This is the root directory of our database
    • staticFilesDirectory

      public final String staticFilesDirectory
      Root directory of static files
    • logLevels

      public final List<LoggingLevel> logLevels
      The default logging levels
    • keystorePath

      public final String keystorePath
      The path to the keystore, required for encrypted TLS communication
    • keystorePassword

      public final String keystorePassword
      The password of the keystore, used for TLS
    • maxReadSizeBytes

      public final int maxReadSizeBytes
      this is the most bytes we'll read while parsing the Request body
    • maxReadLineSizeBytes

      public final int maxReadLineSizeBytes
      this is the most bytes we'll read on a single line, when reading by line. This is especially relevant when reading headers and request lines, which can bulk up with jwt's or query strings, respectively.
    • socketTimeoutMillis

      public final int socketTimeoutMillis
      How long will we let a socket live before we crash it closed? See Socket.setSoTimeout(int)
    • keepAliveTimeoutSeconds

      public final int keepAliveTimeoutSeconds
      We include this value in the keep-alive header. It lets the browser know how long to hold the socket open, in seconds, before it decides we aren't sending anything else and closes it.
    • vulnSeekingJailDuration

      public final int vulnSeekingJailDuration
      If a client does something that we consider an indicator for attacking, put them in jail for a longer duration.
    • isTheBrigEnabled

      public final boolean isTheBrigEnabled
      TheBrig is what puts client ip's in jail, if we feel they are attacking us. If this is disabled, that functionality is removed.
    • suspiciousErrors

      public final List<String> suspiciousErrors
      These are a list of error messages that often indicate unusual behavior, maybe an attacker
    • suspiciousPaths

      public final List<String> suspiciousPaths
      These are a list of paths that often indicate unusual behavior, maybe an attacker
    • startTime

      public final long startTime
      This value is the result of running System.currentTimeMillis() when this class gets instantiated, and that is done at the very beginning.
    • extraMimeMappings

      public final List<String> extraMimeMappings
      These are key-value pairs for mappings between a file suffix and a mime type.

      These are read by our system in the StaticFilesCache as key-1,value-1,key-2,value-2,... and so on.

      See Also:
    • staticFileCacheTime

      public final long staticFileCacheTime
      Length of time, in seconds, for static files to be cached, per the provisions of the Cache-Control header, e.g.
           Cache-Control: max-age=300
       
    • useCacheForStaticFiles

      public final boolean useCacheForStaticFiles
      Whether we will use caching for the static files.

      When a user requests a path we don't recognize, we go looking for it. If we have already found it for someone else, it will be in a cache.

      However, if we are doing development, it helps to not have caching enabled - it can confuse.

    • maxElementsLruCacheStaticFiles

      public final int maxElementsLruCacheStaticFiles
      This constant controls the maximum number of elements for the LRUCache we create for use by FileUtils. As files are read by FileUtil's methods, they will be stored in this cache, to avoid reading from disk. However, caching can certainly complicate things, so if you would prefer not to store these values in a cache, set useCacheForStaticFiles to false.

      The unit here is the number of elements to store in the cache. Be aware: elements can be of any size, so two caches each having a max size of 1000 elements could be drastically different sizes.

  • Constructor Details

    • Constants

      public Constants()
    • Constants

      public Constants(Properties props)
  • Method Details

    • getConfiguredProperties

      public static Properties getConfiguredProperties()
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object