-
Feb 1st, 2012, 03:42 AM
#1
UriTemplate and optional query parameters
Hi,
I am looking for a way to generate url with optional query parameters.
I start with an object
public class MyObject{
private String name;
private Integer age;
//.. setters getters
}
Depending on attribute values, I need to produce different urls.
For example:
www.my.url/test/?name=myname&age=myage //in this case both name and age have values
www.my.url/test/?age=myage //name is null
www.my.url/test/?name=myname //age is null
I thought that I can use the UriTemplate, but could not figure out the way.
Any help is appreciated.
Thanks,
Julia
-
Feb 3rd, 2012, 02:06 PM
#2
Check UriComponentsBuilder in Spring 3.1. You can add query params in a loop.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules