BT

Deep Linking in Flex with URLKit

| by Jon Rose Follow 0 Followers on Oct 13, 2008. Estimated reading time: 2 minutes |
In Rich Internet Applications, Deep Linking is the ability to link directly into a specific state of the application without reloading the application. This is a common experience in traditional browser applications that users expect to still work regardless of implementation technology. In Flex 3, Deep Linking support was added, but does not support many advanced requirements. For those cases, Flex developers can use URLKit.

InsideRIA recently covered URLKit in detail:
Flex 2 provided the history management functionality. There are several reasons why this isn't a complete solution for an application that needs to preserve as much of the traditional browser experience as possible. The developer has little control over the specific URL and how it maps to the specific state of the application (the URL's are automatically created by the Flex application). This also makes it nearly impossible to preserve a URL structure for a future version of the application.

URLKit seeks to extend this type of technology by giving the developer fine-grained bi-directional control over the relationship between the URL and the application's state. It allows you to declare URL mappings for a state of your application within MXML.
URLKit provides four main rules for controlling the URL and corresponding application state:
  • UrlValueRule - As show previously, this rule enables the developer to map a portion of the URL to a property of the application. When using the UrlValueRule in this manner, the two values (the URL and the application property) are both bound to each other, which means that a change in one will mean a change in the other. If you do not wish to use the binding, UrlValueRule also dispatches a change event which can also be used to trigger a change in state.
  • UrlNavigatorRule - It was mentioned previously that our application could have benefitted from a different rule other than UrlValueRule. UrlNavigatorRule is designed specifically to work with Accordian's, NavBar's, TabNavigator's, and ViewStack's. So, instead of having to map the URL value to the selectedIndex property, you simply need to tell the rule what navigator it needs to point to. It handles the rest. Sample UrlNavigatorRule Example (View Source Enabled)
  • UrlDelegateRule - This rule allows the developer to pass off a portion of the URL mapping to another rule (or rule set). This is commonly used so that the main application can pass off a portion of the mapping to a child component. In that way the URL can reflect the state of nested components. For this to work properly, you will need to use the next rule, UrlRuleSet.
  • UrlRuleSet - This rule allows you to group multiple rules together so that a single URL can be parsed for multiple values. It also allows you to state in which way you want to the child rules to match the URL.
Learn more about URLKit: http://code.google.com/p/urlkit/.

Rate this Article

Adoption Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss
BT