[zanata-devel] Approach to implementing locale mappings REST endpoint

Carlos Munoz camunoz at redhat.com
Tue Dec 9 23:55:28 UTC 2014


Could we just create two java methods, each mapped to each of the url
options, and have them call some common logic? We would need to make
sure both options work (not entirely sure how resteasy determines which
one to apply. Maybe it goes in order testing the reg exps).

That way we keep the urls a bit more readable. There's also the fact
that in the api documentation 'prefix' would not show up automatically.

We could also do it at the urlrewrite level. Again, no docs for the
endpoint, but it's transparent to the code.

Carlos A. Munoz
Software Engineering Supervisor
Engineering - Internationalization
Red Hat

On 12/10/2014 09:45 AM, David Mason wrote:
> ----- Original Message -----
>> From: "David Mason" <damason at redhat.com>
>> To: "zanata-devel" <zanata-devel at redhat.com>
>> Sent: Tuesday, 9 December, 2014 11:40:40 AM
>> Subject: Re: [zanata-devel] Approach to implementing locale mappings REST	endpoint
> 
>> ... I may have a brief look at whether there
>> is a lightweight way to add such an alias, and add anything I find to this
>> thread.
> 
> It looks like multiple paths to the same resource is easy to achieve, using a regular expression variable.
> 
> For the paths:
> .../projects/p/{projectSlug}
> .../project/{projectSlug}
> 
> We could use something like this:
> @Path(REST_PATH + "/{prefix:project(s/p)?}/{projectSlug}")
> 
> This would match both the paths, and would give @PathParam("prefix") which may be handy for tracking how often each alternative is being used.
> 
> 
> See: http://docs.jboss.org/resteasy/docs/1.0.2.GA/userguide/html_single/index.html#_Path_and_regular_expression_mappings
> 
> 
> Cheers,
> 
> David Mason
> Software Engineer
> L10n Engineering
> 
> Red Hat, Asia-Pacific Pty Ltd
> Level 1, 193 North Quay
> Brisbane 4000
> 
> _______________________________________________
> zanata-devel mailing list
> zanata-devel at redhat.com
> https://www.redhat.com/mailman/listinfo/zanata-devel
> 




More information about the zanata-devel mailing list