java servlet dynamic @path using Jersey

LiLRiceBoi

Golden Member
Dec 2, 2000
1,211
0
0
Hi I'm pretty new to Jersey and I was wondering if it was possible to dynamically define the URI pattern based on some XML config file.

e.g. I have an XML that contains the following nodes
<params>
<a>1</a>
<b>2</b>
<c>3</c>
</params>

I want to build an @path that looks like
@Get
@Path("{a}/{b}/{c}")
public string dynamicquery(@PathParam("a") String a, @PathParam("b") String b, @PathParam("c") String c)
{...}

I have a predefined set of nodes I need to use, but dont know which ones are going to be used or how many. I want to define that based on the config XML.

Thanks

edit: I'm thinking I can have @Path("{path}") and then split by / to get each individual parameter. Is this a good idea or is there a better way to do this?
 
Last edited: