Paul,
Thanks. The filter will suit my needs perfectly. I figured there was
some mechanism to do that, I just didn't know what it was.
BTW, the Jersey stuff is great. You've made my job much easier!
Thanks again,
Larry
_____
From: Paul.Sandoz_at_Sun.COM [mailto:Paul.Sandoz_at_Sun.COM]
Sent: Wednesday, March 11, 2009 4:45 AM
To: users_at_jersey.dev.java.net
Subject: Re: [Jersey] Case Insensitive QueryParams
Hi Larry,
This is not currently supported by JAX-RS or Jersey but it seems like
something that would be useful with an annotation e.g. @CaseInsensitive.
Unfortunately JAX-RS 1.1 is now finished so it would have to be
considered to JAX-RS 2.0 (although no plans have been made for that,
yet).
BUT there is another way :-) use a Jersey request filter [1] and
normalize the request URI so that all the query parameters names are
converted to lower case.
You can get all the URI information from the ContanerRequest, build a
new normalized URI using UriBuilder, and then set that normalized URI on
the ContainerRequest using ContainerRequest.setUris.
Paul.
[1]
https://jersey.dev.java.net/source/browse/*checkout*/jersey/tags/jersey-
1.0.2/api/jersey/com/sun/jersey/spi/container/ContainerRequestFilter.htm
l
On Mar 11, 2009, at 2:55 AM, Touve, Larry E (US SSA) wrote:
Hi,
Is there any way to declare queryparams that are case insensitive? I'd
like to do something like:
@PATH("/CSW")
Public class myclass
{
:
@GET
@Produces(MediaType.APPLICATION_XML)
public Response get(@QueryParam("service") String service,
@QueryParam("request") String request, ...)
{
<some code...>
}
And be able to send requests like:
http://localhost:8080/APP/CSW?service=CSW&request=GetRecords&...
As well as
http://localhost:8080/APP/CSW?SERVICE=CSW&REQUEST=GetRecords&...
Or even
http://localhost:8080/APP/CSW?Service=CSW&Request=GetRecords&...
I am currently calling uri.getQueryParameters to get the map, and can
toUpperCase all the keys, but I'd like to utilize the QueryParam
annotations for the mandatory query parameters. Has anyone come across
a situation like this before?
Thanks,
Larry