标签云

微信群

扫码加入我们

WeChat QR Code

I need to implement an API with these path params.@Path("/job/{param1}/{optional1}/{optional2}/{param2}")Can the second and third params by optional? So the client need not pass these, but have to pass the first and last.If this is not possible, then is it recommended to rearrange the params in this way?@Path("/job/{param1}/{param2}/{optional1}/{optional2}")How to provide the optional params?


it's better to rearrange the params, If I had a choice, I would have separated mandatory and optional in 2 sections, separated by a delimiter in URL, then make mandatory as positional, and optional as key value pair, I don't know how, which client, under what scenario you are writing the code, what have you tried till now?

2019年04月22日41分05秒

abasu I am using JAX-RS. I referred to nakov.com/blog/2009/07/15/…. Is it required to use regex, or is there any other way?

2019年04月22日41分05秒

How would you distinguish optional1 and optional2 in /job/foo/bar/baz? What is bar?

2019年04月22日41分05秒

I am able to provide optional parameters using the solution provided in www.nakov.com/blog/2009/07/15/jax-rs-path-pathparam-and-optional-parameters. So my issue is resolved now.

2019年04月22日41分05秒

Mind mentioning source? nakov.com/blog/2009/07/15/…

2019年04月22日41分05秒