Issue Details (XML | Word | Printable)

Key: JERSEY-1336
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Pavel Bucek
Reporter: gdavison
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
jersey

WADL for Matrix parameters are in contravention of the WADL specification

Created: 02/Aug/12 02:33 PM   Updated: 23/Aug/12 03:57 PM   Resolved: 23/Aug/12 03:57 PM
Component/s: None
Affects Version/s: 1.13
Fix Version/s: 1.14

Time Tracking:
Not Specified

Tags:
Participants: gdavison and Pavel Bucek


 Description  « Hide

Section 2.12 of the WADL specification states that a matrix parameter can only exist on a resource element:

http://www.w3.org/Submission/wadl/#x3-250002.12

But if you run this trivial example:

package project1;

import javax.ws.rs.GET;
import javax.ws.rs.MatrixParam;
import javax.ws.rs.Path;

@Path("/matrix")
public class MatrixExample {

private String con;

public MatrixExample() {
}

@GET
public String matrixExample(@MatrixParam("param") String param) { return param + " " + con; }

@MatrixParam("con")
public void setCon(String con) { this.con = con; }

public String getCon() { return con; }
}

Then you end up with the following WADL which is in contravention of the specification:

<?xml version="1.0" encoding="UTF-8"?>
<ns0:application xmlns:ns0="http://wadl.dev.java.net/2009/02">
<ns0:doc xmlns:ns1="http://jersey.java.net/" ns1:generatedBy="Jersey: 1.13-b01 03/09/2012 03:52 PM"/>
<ns0:grammars/>
<ns0:resources base="http://localhost:7101/Application1-Project1-context-root/resources/">
<ns0:resource path="/matrix">
<ns0:param name="con" style="matrix" xmlns:ns2="http://www.w3.org/2001/XMLSchema" type="ns2:string"/>
<ns0:method id="matrixExample" name="GET">
<ns0:request>
<ns0:param name="param" style="matrix" xmlns:ns3="http://www.w3.org/2001/XMLSchema" type="ns3:string"/>
</ns0:request>
<ns0:response>
<ns0:representation mediaType="/"/>
</ns0:response>
</ns0:method>
</ns0:resource>
</ns0:resources>
</ns0:application>

The second matrix parameter should be added at the resource level, this shouldn't be a problem for other methods as parameter are optional by default.