Class AllowedHttpMethodsCustomizer

java.lang.Object
com.illumon.iris.web.server.AllowedHttpMethodsCustomizer
All Implemented Interfaces:
org.eclipse.jetty.server.HttpConfiguration.Customizer

public class AllowedHttpMethodsCustomizer extends Object implements org.eclipse.jetty.server.HttpConfiguration.Customizer
Limits the allowed HTTP methods to those specified in the configuration. When set on the http configuration itself, this is applied for all calls made to the server, regardless of context.

Common HTTP methods to support include:

  • GET - allows clients to fetch resources, such as static HTML/JS content or connection.json file.
  • POST - typical method for sending/receiving data to the server, such as for RPC calls.
  • PUT - typical method for modifying a REST resource
  • DELETE - typical method for deleting a REST resource
  • OPTIONS - part of the CORS handshake, allowing browsers to request content from a server despite being loaded from a different host/port
  • Constructor Details

    • AllowedHttpMethodsCustomizer

      public AllowedHttpMethodsCustomizer(Set<String> allowedMethods)
      Creates a new instance of the customizer, allowing only the specified HTTP methods.
      Parameters:
      allowedMethods - the HTTP methods to allow
  • Method Details

    • customize

      public org.eclipse.jetty.server.Request customize(org.eclipse.jetty.server.Request request, org.eclipse.jetty.http.HttpFields.Mutable mutable)
      Specified by:
      customize in interface org.eclipse.jetty.server.HttpConfiguration.Customizer