users@jersey.java.net

Re: Help With Matrix Parameter Problem

From: Jakub Podlesak <Jakub.Podlesak_at_Sun.COM>
Date: Tue, 09 Oct 2007 14:39:51 +0200

Hi Hien,

if i try to modify the [HelloWorld] example (http container), it works for me:
--cuthere--
// The Java class will be hosted at the URI path "/helloworld"
@UriTemplate(value = "/helloworld")
public class HelloWorldResource {
    
    // The Java method will process HTTP GET requests
    @HttpMethod("GET")
    // The Java method will produce content identified by the MIME Media
    // type "text/plain"
    @ProduceMime("text/plain")
    public String getUser(@MatrixParam("fn") String param) {
        // Return some cliched textual content
        return "param is " + param;
    }
}
--cuthere--

The same works fine with GlassFish ([HelloWorldWebApp] -- servlet container).

I use latest jersey code from the main trunk.

What version (and container) are you using?

Please do not hesitate to file a bug report at [1] and attach your project files
there as a reproducible test case.

Thank you a lot!

~Jakub

[1]https://jersey.dev.java.net/issues/

On Mon, Oct 08, 2007 at 04:39:11PM -0700, Hien Luu wrote:
> I am trying to use the MatrixParam annotation to grab the value out of a matrix parameter, but just doesn't work for me. I must be missing something. Here is my resource class:
>
> @UriTemplate("/users")
> public class UsersResource {
> public UsersResource() {
> }
>
> @HttpMethod
> public String getUsers(@MatrixParam("fn") String firstName) {
>
> return "first-name: '" + firstName + "'";
> }
> }
>
> When I tried http://host:8080/jersey/users;fn=Mike and I am expecting "first-name: 'Mike'", but kept getting "first-name: 'null'".
>
> Thanks in advance,
>
> Hien