users@jersey.java.net

[Jersey] Declarative Hyperlinking and a slash in an id

From: thehpi <thehpi_at_hotmail.com>
Date: Wed, 19 Oct 2011 06:24:57 -0700 (PDT)

Hi,

I'm using Declarative Hyperlining to set an uri field on a class using this:

    @Ref(
        value = "accounting/invoices/type/{type}/id/{id}",
               style = Style.ABSOLUTE,
        bindings = {
                        @Binding(name = "id", value = "${instance.invoiceId}"),
                    @Binding(name = "type", value = "${resource.invoiceType}")
            }
    )
        private URI uri;

This works oke except when the {id} contains a slash, e.g.

  a/b

The slash is not url encoded so I thought maybe I need to do it myself.
But when I did I found that there is actually url encoding happening except
not for a slash.
My result is now

 a%252Fb

This is because I'm url encoding into a%2Fb and jersey is encoding the %
into %25.

Is there a way I can tell jersey to encode the slash aswell?

tx

Hans

--
View this message in context: http://jersey.576304.n2.nabble.com/Declarative-Hyperlinking-and-a-slash-in-an-id-tp6908637p6908637.html
Sent from the Jersey mailing list archive at Nabble.com.