[ 
https://issues.apache.org/jira/browse/CXF-8216?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andrei Ivanov updated CXF-8216:
-------------------------------
    Description: 
After reading 
[https://nakov.com/blog/2009/07/15/jax-rs-path-pathparam-and-optional-parameters/],
 I tried to define my own:
{code:xml}
<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>
{code}
The problem seems to be that the generator treats *path* params as 
[required|https://github.com/apache/cxf/blob/5ed6310b1621f8a61172c3be85ab66af0310af67/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/jaxrs/SourceGenerator.java#L1246].

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.

  was:
After reading 
https://nakov.com/blog/2009/07/15/jax-rs-path-pathparam-and-optional-parameters/,
 I tried to define my own:
{code:xml}
<resource path="/{uuid}{version:(/version/[^/]+?)?}/scan-code/{code}">
    <param name="uuid" style="template" type="ns:UUID" required="true"/>
    <param name="version" style="template" type="xs:unsignedInt" 
required="false"/>
    <param name="code" 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>
{code}

The problem seems to be that the generator treats *path* params as 
[required|https://github.com/apache/cxf/blob/5ed6310b1621f8a61172c3be85ab66af0310af67/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/jaxrs/SourceGenerator.java#L1246].


> Support optional path params in wadl2java
> -----------------------------------------
>
>                 Key: CXF-8216
>                 URL: https://issues.apache.org/jira/browse/CXF-8216
>             Project: CXF
>          Issue Type: Bug
>          Components: Tooling
>    Affects Versions: 3.3.5
>            Reporter: Andrei Ivanov
>            Priority: Major
>
> After reading 
> [https://nakov.com/blog/2009/07/15/jax-rs-path-pathparam-and-optional-parameters/],
>  I tried to define my own:
> {code:xml}
> <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>
> {code}
> The problem seems to be that the generator treats *path* params as 
> [required|https://github.com/apache/cxf/blob/5ed6310b1621f8a61172c3be85ab66af0310af67/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/jaxrs/SourceGenerator.java#L1246].
> 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.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to