dev@jersey.java.net

MatrixParam help?

From: Ayub Khan <Ayub.Khan_at_Sun.COM>
Date: Wed, 31 Oct 2007 11:15:29 -0700

Hi Paul,

With 0.4ea jersey available in REST modules of NB6.0 trunk.

I was trying MatrixParam annotation.


    /**
     * Retrieves representation of an instance of hello.HelloWorldResource
     * @return an instance of java.lang.String
     */
    @HttpMethod("GET")
    @ProduceMime("application/xml")
    public String getXml(@MatrixParam("name") String name) {
        return "<?xml version='1.0' encoding='UTF-8'?>\n<b>Hello
"+name+"</b>";
    }

After deploying the app, if I try the URL
http://localhost:8080/CustomerDB/resources/hello3;name=test
I get 404 error on the browser.

Also checked the wadl, it does not have a param element
(I was expecting this element also to have a style="matrix" attribute)
for the resource hello3.

application.wadl
---------------------
...
        <resource path="hello3">
            <method name="GET">
                <request>
                    <representation/>
                </request>
                <response>
                    <representation mediaType="application/xml"/>
                </response>
            </method>
...
----------------------


Can you please provide a sample and how to test it.

Thanks
Ayub