Centralized way of organizing urls in Jersey?
        Posted  
        
            by drozzy
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by drozzy
        
        
        
        Published on 2010-05-26T20:10:23Z
        Indexed on 
            2010/05/27
            3:21 UTC
        
        
        Read the original article
        Hit count: 218
        
Forgive me if I am asking an obvious question (maybe I missed it in the docs somewhere?) but has anyone found a good way to organize their URLs in Jersey Java framework?
I mean organizing them centrally in your Java source code, so that you can be sure there are not two classes that refer to the same Url.
For example django has a really nice regex-based matching. I was thinking of doing something like an enum:
enum Urls{
    CARS  ("cars"),
    CAR_INFO ("car", "{info}");
    public Urls(String path, String args) 
    ...
}
but you can imagine that gets out of hand pretty quickly if you have urls like:
cars/1/wheels/3
where you need multiple path-ids interleaved with one another...
Any tips?
© Stack Overflow or respective owner