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

ParamConverter don't work for primitive types

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 3.7.0.Final, 4.1.0.Final
    • 3.6.3.Final, 4.0.0.CR2
    • jaxrs
    • None
    • Compatibility/Configuration
    • Hide

      No workaround available!

      Show
      No workaround available!

      RESTEasy currently doesn't support using ParamConverters for any kind of primitive type. IMO this is a violation of the JAX-RS spec. The API docs of ParamConverterProvider doesn't restrict the types for which users can register custom converters. Jersey for example supports converters for all types, including primitives.

      I think that all the problematic code can be found in the StringParameterInjector.

      In case of primitive types, it doesn't even try to lookup the ParamConverter:

      https://github.com/resteasy/Resteasy/blob/63862e7e5b109d56227a9450fd1dc209cc926597/resteasy-core/src/main/java/org/jboss/resteasy/core/StringParameterInjector.java#L462-L473

      And later on it converts primitive types using StringToPrimitive BEFORE even checking if there is a ParamConverter:

      https://github.com/resteasy/Resteasy/blob/63862e7e5b109d56227a9450fd1dc209cc926597/resteasy-core/src/main/java/org/jboss/resteasy/core/StringParameterInjector.java#L682-L698

      Thoughts?

              rhn-support-asoldano Alessio Soldano
              christian@kaltepoth.de Christian Kaltepoth (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: