I’m building a URL to gain access to a users Google calendar with the google-javi-api as such:
CalendarUrl url = CalendarUrl.forEventFeed("accountName", "private", "full");
which returns me this url:
"https://www.google.com/calendar/feeds/user@gmail.com/private/full?prettyprint=true"
I would like to set parameters to this URL with startMin and startMax parameters so the URL would eventually look like this:
"https://www.google.com/calendar/feeds/default/private/full?start-min=2011-06-00T00:00:00&start-max=2011-06-24T23:59:59"
All of my attempts at this have failed, and after logging the URL that is being returned, I find that the “?” is being replaced by “%3F” and ampersands are being replaced by “&”
The incorrect url that is bring returned is:
"https://www.google.com/calendar/feeds/default/private/full%3Fstart-min=2011-06-00T00:00:00&start-max=2011-06-24T23:59:59"
I’m pretty sure the reason my result set is null is because of those character replacements. How do I append the original URL with the new parameters?
**If you’re wondering how I’m building this url, I’m using the CalendarURL class from this sample Android implementation of Google Calendar.
EDIT
More specifically, in the CalendarURL class, I can add parts to the “path” of the URL, but I can’t find a way to include a query parameter. Does this API not include a way to specify a parameter?
The proper way to create a URL using google-java-client-api is to extend the GoogleUrl object. (I’m using Google Latitude here as a sample. I create a GoogleUrl object, and later on you’ll see how it gets used).
The Google URL object
A sample URL object looks like this:
Usage
You use this object to construct the URL, just fill in your parameters (the @Key annotated fields), and execute the build() method to get a string representation of it :
Output :