On May 21, 2009, at 10:26 PM, Rabick, Mark A (IS) wrote:
> Thanks Paul.
>
> I verified that the resource method was returning the expected
> status/URI:
>
> mapUri:
> http://localhost:7001/i3/cnodb/cdal/rest/v1/attributemaps/70489910000032
> %20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20
> Node - getEntityAttributeMap [END] response status: 303
>
> I set the Client.setFollowRedirects(Boolean.FALSE) my Junit test  
> passed
> - received a status 303 with the URI.  I have to figure out what's  
> going
> on with the redirected URI.  The key value I'm appending to the URI is
> an explicit foreign key constraint in our database.  The key is a
> char(32) so I'm not sure about the spaces (%20)
>
The encoding is correct.
> The resource method for the redirected target URI is:
>
> @Path("{mapsk: [a-zA-Z0-9 ]{32}}")
> 	public AttributeMapV1Resource
> getMapV1Resource(@PathParam("mapsk") String mapsk)
>
> Maybe the regex is incorrect?  The sk characters need to be letters,
> digits, or a space.
>
The problem is that path matching happens in encoded space, which  
needs to happen so that information in the path is not lost e.g. think  
of the case of a URI that is encoded as a path segment.
For non regex declare @Path declarations Jersey will contextually  
encode the path. For regexes this would be a very tricky operation so  
it is important when using regexes that you are matching the encoded  
space (which in your case will include the %20 character sequences).
I recommend you either explicitly encode the key using say base64 or  
use a different key generation that does not have space characters in  
it. Alternatively change the regex expression to match just segment  
and do the validation yourself, which you can define a class with a  
String constructor and do:
         @Path("{mapsk}")
        public AttributeMapV1Resource
         getMapV1Resource(@PathParam("mapsk") Key mapsk)
Paul.