Class MimeTypes.Mutable

java.lang.Object
org.eclipse.jetty.http.MimeTypes
org.eclipse.jetty.http.MimeTypes.Mutable
Enclosing class:
MimeTypes

public static class MimeTypes.Mutable extends MimeTypes
  • Constructor Details

    • Mutable

      public Mutable()
    • Mutable

      public Mutable(MimeTypes defaults)
  • Method Details

    • isDefault

      public boolean isDefault()
    • addMimeMapping

      public String addMimeMapping(String extension, String type)
      Set a mime mapping
      Parameters:
      extension - the extension
      type - the mime type or null to remove a mapping
      Returns:
      previous value
    • addInferred

      public String addInferred(String mimeType, String encoding)
      Add an inferred encoding for a mimeType
      Parameters:
      mimeType - The mimeType to infer an encoding for
      encoding - The encoding or null to remove
      Returns:
      true if the encoding was added
    • addAssumed

      public String addAssumed(String mimeType, String encoding)
      Add an assumed charset encoding for a content-type. Default values for this mapping are set by the "encoding.properties" class path resource.
      Parameters:
      mimeType - The mimeType to map to an encoding, either in absolute form (e.g. "text/html") or wildcard form (e.g. "image/*").
      encoding - The assumed encoding; or the empty string if it is assumed to have no charset; or null if there is no assumed charset.
      Returns:
      The old value.
    • setMimeTypes

      public void setMimeTypes(Resource mimeProperties) throws UncheckedIOException
      Set the mime types from a properties file in the format "ext=mimeType" (e.g. "txt=text/plain")
      Parameters:
      mimeProperties - The property file to use.
      Throws:
      UncheckedIOException - if there is an IOException
      See Also:
    • addMimeTypes

      public void addMimeTypes(Resource mimeProperties) throws UncheckedIOException
      Add the mime types from a properties file in the format "ext=mimeType" (e.g. "txt=text/plain")
      Parameters:
      mimeProperties - The property file to use.
      Throws:
      UncheckedIOException - if there is an IOException
      See Also:
    • setEncodings

      public void setEncodings(Resource encodingProperties) throws UncheckedIOException
      Set the inferred and assumed encodings from a property file in the format of:
      mimeType=encoding
      An inferred encoding for the mimeType
      mimeType=-encoding
      An assumed encoding for the mimeType
      mimeType=-
      An assumed no encoding for the mimeType
      The mimeType may be a wildcard like "image/*"
      Parameters:
      encodingProperties - The property file to use.
      Throws:
      UncheckedIOException - if there is an IOException
      See Also:
    • addEncodings

      public void addEncodings(Resource encodingProperties) throws UncheckedIOException
      Add the inferred and assumed encodings from a property file in the format of:
      mimeType=encoding
      An inferred encoding for the mimeType
      mimeType=-encoding
      An assumed encoding for the mimeType
      mimeType=-
      An assumed no encoding for the mimeType
      The mimeType may be a wildcard like "image/*"
      Parameters:
      encodingProperties - The property file to use.
      Throws:
      UncheckedIOException - if there is an IOException
      See Also:
    • setFrom

      public void setFrom(MimeTypes other)
      Set the MimeTypes mappings and encodings from another MimeTypes
      Parameters:
      other - The other MimeTypes.
    • mergeFrom

      public void mergeFrom(MimeTypes other)
      Merge the MimeTypes mappings and encodings from another MimeTypes. Any non default values in this instance are kept in preference to the values from the other.
      Parameters:
      other - The other MimeTypes.