Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(16896)

Issue 68230043: Decouple HttpRequest from GenericUrl to allow generic url building

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 2 months ago by Jamie Couture
Modified:
10 years, 2 months ago
Reviewers:
wonderfly
Visibility:
Public.

Description

Right now HttpRequest and HttpRequestFactory require GenericUrl to eventually construct a URL string when callers eventually call HttpRequest#execute(); HttpRequest @ 863: -- 8< -- String urlString = url.build(); -- 8< -- Reduce coupling between GenericUrl and HttpRequest / HttpRequestFactory from URL string building to allow others to provide their own URL building logic. GenericUrl, for most people, will do what they want; especially if they conform to UriTemplate's RFC 6570. My rationale is that GenericUrl is designed to not allow easy extending to avoid change in the parsing behaviour of query parameter construction due to initial design and parsing constraints. It is reasonable that one might like to design a similar class to GenericUrl such that the convenience of query parameter construction is maintained by Genericdata, but the actual representation of query parameters may be different. For example, MyGenericUrl would construct query parameter strings to appear as the following: -- 8< -- class A extends MyGenericUrl { @Key List<String> list; @key Map<String, Object> map; } Map<String, Object> map = new HashMap<String, Object)>(); map.put("key1", "val1"); map.put("key2", "val2"); map.put("key3", "val3"); A a = new A(); a.list = Arrays.asList("val1", "val2"); a.map = map; a.build(); -- 8< -- Might output something like: ?list[]=val1&list[]=val2&map[key1]=val1&map[key2]=val2&map[key3]=val3 I understand this would be a binary incompatible change. Is there a better way to accomplish something like this, considering the current design of GenericUrl?

Patch Set 1 #

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b