Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-5887

Enum issue for REST requests

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
    • Environment:

      CXF Version: 2.7.4
      JDK - build 1.7.0_40-b43

    • Estimated Complexity:
      Unknown

      Description

      I am not sure weather its bug or I am doing something wrong. Basically I am creating REST API with Enum as one of the QueryParam. The Enum class is generated from xsd :

      Enum in xsd:
      <xsd:simpleType name="CodeEnum">
      <xsd:restriction base="xsd:string">
      <xsd:enumeration value="One" />
      <xsd:enumeration value="Two" />
      <xsd:enumeration value="Hello World" />
      </xsd:restriction>
      </xsd:simpleType>

      Jaxb class for Enum has variables ONE("One"), TWO("Two"), HELLO_WORLD("Hello World")

      REST API: getCode(@QueryParam("code") CodeEnum code);

      CXF Generated WADL content for API is :

      <resource path="getCode">
      <method name="GET">
      <request>
      <param name="code" style="query" type="xs:string">
      <option value="ONE"/>
      <option value="TWO"/><option value="HELLO_WORLD"/>
      </param></request>

      Here What I observed in wadl is options values are Enum names I would expect Enum values..

      If above wadl option is selected . CXF server throws IllegalArgumentException since it could not find ONE.

      Is it bug or is there any work around to solve this issue

      Thanks in advance.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                winaykumar Vinay Kumar
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: