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

Support optional path params in wadl2java

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 3.3.5
    • Fix Version/s: None
    • Component/s: Tooling
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      After reading https://nakov.com/blog/2009/07/15/jax-rs-path-pathparam-and-optional-parameters/, I tried to define my own:

      <resource path="/{uuid}\{version:(/version/[^/]+?)?\}/scan-code/{codez}">
          <param name="uuid" style="template" type="ns:UUID" required="true"/>
          <param name="version" style="template" type="xs:unsignedInt" required="false"/>
          <param name="codez" style="template" required="true" />
          <method id="scanCode" name="PATCH">
              <doc>Scan code</doc>
              <request>
                  <!--
                  <param name="version" style="matrix" type="xs:unsignedInt">
                      <doc>Version of the sales transaction.</doc>
                  </param>
                  -->
              </request>
              <response>
                  <representation mediaType="application/json" element="ns:SalesTransaction"/>
                  <representation mediaType="application/xml" element="ns:SalesTransaction"/>
              </response>
          </method>
      </resource>
      

      The problem seems to be that the generator treats path params as required.

      I was actually trying to define it as a matrix param, but it seems that a matrix param isn't really supported by JAX-RS at the end of the URL, not in middle path segments.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              shadow Andrei Ivanov
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: