Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-3283

Do not throw an exception for OPTIONS request

XMLWordPrintable

    It seems like RESTEasy has been throwing this exception for a long time. Maybe even since OPTIONS support was added. This seems odd since it would be processed via an ExceptionMapper.

    It's even documented as such in the RESTEasy documentation.

    Exception HTTP Code Description
    DefaultOptionsMethodException N/A If the user invokes HTTP OPTIONS and no Jakarta RESTful Web Services method for it, RESTEasy provides a default behavior by throwing this exception

    It definitely looks odd to me that by default if a method is not annotated with @OPTIONS then an exception is thrown. I don't see in the spec where it requires an exception to be thrown:
    https://jakarta.ee/specifications/restful-ws/3.1/jakarta-restful-ws-spec-3.1.html#head_and_options

    On receipt of an OPTIONS request an implementation MUST either:

    1. Call a method annotated with a request method designator for OPTIONS or, if none present,
    2. Generate an automatic response using the metadata provided by the JAX-RS annotations on the matching class and its methods.

            jperkins-rhn James Perkins
            jperkins-rhn James Perkins
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: