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

Issue 174079: URL Generation System Overhaul (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
15 years, 9 months ago by johnfargo
Modified:
15 years, 8 months ago
Reviewers:
Paul Lindner, chirag, shindig.remailer
Base URL:
http://svn.apache.org/repos/asf/incubator/shindig/trunk/
Visibility:
Public.

Description

This patch implements a new set of URL(/I) generation interfaces designed to replace the current UrlGenerator and LockedDomainService interfaces. However, it does *not* actually replace these, instead providing shim code (GlueUrlGenerator) that binds the new interfaces together. This is done for two reasons: 1. Use of UrlGenerator is extensive in the Shindig codebase (easy to substitute). 2. Further, outside users are known to override UrlGenerator/DefaultUrlGenerator for custom purposes. As such, this should be treated as Phase I (phase II may be to provide "reverse" shims from UrlGenerator to the new interfaces, though that may not be possible in full). Three new interfaces are introduced, all with roughly the same implementation pattern: 1. IframeUriManager - Responsible for generating IFRAME rendering URIs. - Includes methods to create an IFRAME URI and validate a created URI (for host, path, version, etc. matching). - UriStatus returned from validate method includes INVALID_DOMAIN state. Method and state intended to replace LockedDomainService. 2. JsUriManager - Creates and validates URIs used by JsServlet and rendering code. 3. OAuthUriManager - Generates (no validation needed) OAuth callback URIs. In addition, the following core pieces are provided: 1. LockedDomainPrefixGenerator - Interface used for generating a locked-domain prefix from a Gadget's URI. 2. UriCommon - Exports constants for Params used by Shindig, to avoid hard-coded values. 3. UriStatus - New, more complete enum of Uri validation statuses, including locked-domain. Default implementations of all interfaces are provided: 1. DefaultIframeUriManager - Uses *new* container config values to differentiate from existing UrlGenerator (and to cohesively bundle config in one place). This allows config for both to coexist easily. - Supports URI templating. This is useful for supporting metadata services that return more highly-cacheable URIs, which are trivially manipulated into "complete" URIs through string substitution. - Intelligently places user prefs on the fragment or query string, depending on whether they're needed for rendering. - Provides hook to do the same for security token, though this is not implemented in this CL. 2. AllJsIframeVersioner (implements IframeUriManager.Versioner) - Implements existing algorithm for versioning IFRAME URIs (mark them with the checksum of all JS). - Not installed by default, since the algorithm is heuristic at best. 3. DefaultJsUriManager - Generates extern JS URIs from host and path components. - Pulls same apart into constituent components (collection of features and validation status). 4. DefaultJsVersioner - Provides version string for all features used by the given request. This means version params of extern JS change only when their referenced JS does. 5. DefaultOAuthUriManager - Implements the same thing as the current oauth callback generation algorithm: simple URI template. The Uri class is also augmented to support fragment params in addition to query params, to support fragment vs. query param placement. The general design pattern for IFRAME and JS URI generation is to have ContainerConfig supply Host (which may contain scheme) and Path info, and to construct a Uri out of constituent components rather than String-parsing. This tighter structure arguably leads to cleaner, more descriptive code. Lastly, GlueUrlGenerator is an implementation of UrlGenerator that as aforementioned uses the three interfaces above under the hood. This makes it possible to use the new URI generation implementation (and some functionality) without our replacing all callers of UrlGenerator. NOTE: Patch #1 is not yet complete, as it needs DefaultIframeUriManagerTest filled in, as well as UriTest augmented with fragment param tests.

Patch Set 1 #

Patch Set 2 : Missed svn add of uri directories. #

Total comments: 8

Patch Set 3 : Minor update, accommodates Chirag and Paul's comments. #

Patch Set 4 : Completion of tests (DefaultIframeUriManager) and refactor of Uri class for q/f params #

Unified diffs Side-by-side diffs Delta from patch set Stats (+3065 lines, -53 lines) Patch
java/common/src/main/java/org/apache/shindig/common/uri/Uri.java View 3 chunks +28 lines, -0 lines 0 comments Download
java/common/src/main/java/org/apache/shindig/common/uri/UriBuilder.java View 1 2 3 8 chunks +176 lines, -45 lines 0 comments Download
java/common/src/test/java/org/apache/shindig/common/uri/UriBuilderTest.java View 1 chunk +91 lines, -0 lines 0 comments Download
java/gadgets/src/main/java/org/apache/shindig/gadgets/UrlGenerator.java View 1 chunk +0 lines, -7 lines 0 comments Download
java/gadgets/src/main/java/org/apache/shindig/gadgets/uri/AllJsIframeVersioner.java View 1 chunk +72 lines, -0 lines 0 comments Download
java/gadgets/src/main/java/org/apache/shindig/gadgets/uri/DefaultIframeUriManager.java View 2 3 1 chunk +304 lines, -0 lines 0 comments Download
java/gadgets/src/main/java/org/apache/shindig/gadgets/uri/DefaultJsUriManager.java View 2 1 chunk +192 lines, -0 lines 0 comments Download
java/gadgets/src/main/java/org/apache/shindig/gadgets/uri/DefaultJsVersioner.java View 1 chunk +96 lines, -0 lines 0 comments Download
java/gadgets/src/main/java/org/apache/shindig/gadgets/uri/DefaultOAuthUriManager.java View 1 chunk +48 lines, -0 lines 0 comments Download
java/gadgets/src/main/java/org/apache/shindig/gadgets/uri/GlueUrlGenerator.java View 1 chunk +92 lines, -0 lines 0 comments Download
java/gadgets/src/main/java/org/apache/shindig/gadgets/uri/HashShaLockedDomainPrefixGenerator.java View 1 chunk +31 lines, -0 lines 0 comments Download
java/gadgets/src/main/java/org/apache/shindig/gadgets/uri/IframeUriManager.java View 1 chunk +57 lines, -0 lines 0 comments Download
java/gadgets/src/main/java/org/apache/shindig/gadgets/uri/JsUriManager.java View 1 chunk +81 lines, -0 lines 0 comments Download
java/gadgets/src/main/java/org/apache/shindig/gadgets/uri/LockedDomainPrefixGenerator.java View 1 chunk +28 lines, -0 lines 0 comments Download
java/gadgets/src/main/java/org/apache/shindig/gadgets/uri/OAuthUriManager.java View 1 chunk +28 lines, -0 lines 0 comments Download
java/gadgets/src/main/java/org/apache/shindig/gadgets/uri/UriCommon.java View 1 chunk +45 lines, -0 lines 0 comments Download
java/gadgets/src/main/java/org/apache/shindig/gadgets/uri/UriStatus.java View 1 chunk +27 lines, -0 lines 0 comments Download
java/gadgets/src/test/java/org/apache/shindig/gadgets/DefaultUrlGeneratorTest.java View 1 chunk +1 line, -1 line 0 comments Download
java/gadgets/src/test/java/org/apache/shindig/gadgets/uri/AllJsIframeVersionerTest.java View 1 chunk +89 lines, -0 lines 0 comments Download
java/gadgets/src/test/java/org/apache/shindig/gadgets/uri/DefaultIframeUriManagerTest.java View 2 3 1 chunk +771 lines, -0 lines 0 comments Download
java/gadgets/src/test/java/org/apache/shindig/gadgets/uri/DefaultJsUriManagerTest.java View 2 1 chunk +359 lines, -0 lines 0 comments Download
java/gadgets/src/test/java/org/apache/shindig/gadgets/uri/DefaultJsVersionerTest.java View 1 chunk +153 lines, -0 lines 0 comments Download
java/gadgets/src/test/java/org/apache/shindig/gadgets/uri/DefaultOAuthUriManagerTest.java View 1 chunk +75 lines, -0 lines 0 comments Download
java/gadgets/src/test/java/org/apache/shindig/gadgets/uri/GlueUrlGeneratorTest.java View 1 chunk +173 lines, -0 lines 0 comments Download
java/gadgets/src/test/java/org/apache/shindig/gadgets/uri/HashShaLockedDomainPrefixGeneratorTest.java View 1 chunk +48 lines, -0 lines 0 comments Download

Messages

Total messages: 9
johnfargo
15 years, 9 months ago (2009-12-12 02:47:14 UTC) #1
johnfargo
Missed svn add of uri directories.
15 years, 9 months ago (2009-12-12 02:48:20 UTC) #2
chirag
Some minor comments http://codereview.appspot.com/174079/diff/1001/1003 File java/common/src/main/java/org/apache/shindig/common/uri/UriBuilder.java (right): http://codereview.appspot.com/174079/diff/1001/1003#newcode255 java/common/src/main/java/org/apache/shindig/common/uri/UriBuilder.java:255: * Force overwrites a given query ...
15 years, 9 months ago (2009-12-13 01:18:52 UTC) #3
Paul Lindner
looking good. http://codereview.appspot.com/174079/diff/1001/1002 File java/common/src/main/java/org/apache/shindig/common/uri/Uri.java (right): http://codereview.appspot.com/174079/diff/1001/1002#newcode68 java/common/src/main/java/org/apache/shindig/common/uri/Uri.java:68: any particular reason we use a linkedhashmap ...
15 years, 9 months ago (2009-12-16 21:16:41 UTC) #4
johnfargo
Thanks for the look, Chirag. I knew there was a join(...) helper out there somewhere. ...
15 years, 9 months ago (2009-12-16 23:38:05 UTC) #5
johnfargo
Hey Paul: thanks for taking a look. Converted apache.org -> example.com in the tests, and ...
15 years, 9 months ago (2009-12-16 23:41:04 UTC) #6
johnfargo
Minor update, accommodates Chirag and Paul's comments.
15 years, 9 months ago (2009-12-16 23:42:19 UTC) #7
johnfargo
Completion of tests (DefaultIframeUriManager) and refactor of Uri class for q/f params
15 years, 8 months ago (2010-01-06 22:47:43 UTC) #8
johnfargo
15 years, 8 months ago (2010-01-06 23:06:39 UTC) #9
Given completion of Uri refactoring and all tests, plus fact that the new
mechanism isn't used by default, committed this CL. Follow-up comments
welcome.

On Wed, Jan 6, 2010 at 2:47 PM, <johnfargo@gmail.com> wrote:

> Completion of tests (DefaultIframeUriManager) and refactor of Uri class
> for q/f params
>
> http://codereview.appspot.com/174079
>
Sign in to reply to this message.

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