urlreversi: Revert your shortened URLs
Dependency :
compile ":urlreversi:1.0"
Summary
Installation
grails install-plugin urlreversi
Description
Introduction
What it does
This plugin reverses a shortened url - for example http://tinyurl.com/5d4 or http://ow.ly/ZDrQThis plugin really does nothing special. It just detects to which original url the given shrinked url points to and returns this url. Given the simple protocol the typical url shrinking facilities follow (http redirect) it should work with almost all existing shortening services. This plugin provides a service to use from within grails and a convenient tag for direct usage in the web layer. See further documentation below.Use case example
A typical use case for this plugin can be in an grails app that mashes up with twitter posts. Regardless of what shrinking service is used in any tweet - this plugin should be able to resolve the original link on demand and transparently. This can be useful in community environments to improve user convenience or to do some stats about your "community links".Similar tools
There are dozens of similar technologies out there. For example users can install the longurlplease Firefox extension from http://www.longurlplease.com to have only original urls while surfing. A more similar technology is the service that is hosted at http://longurl.org. With this plugin such a service can be realized really easy in a grails app.Ideas for using this plugin within your grails app
You might want to use this plugin in your app: If you have some shortened links that shall be demystified. If you want to detect link doublettes from different shortening services.How to use
- How to use the tag(lib)
- As a text in your html page
<div><urlreversi:revert2Long url='http://bit.ly/1t6DhR'/></div>
- As a link in your html page
<a href="${urlreversi.revert2Long(url:'http://bit.ly/1t6DhR')}">${urlreversi.revert2Long(url:'http://bit.ly/1t6DhR')}</a>- How to use the service
def urlReverterService
- Combined example: AJAX
def urlReverterService def index = { } def ajax = {
def longUrl = urlReverterService.urlReversi(params.url)
render "Long Url: ${longUrl.toString()}"
}<h1>Ajax call: <g:remoteLink action="ajax" params="[url:'http://bit.ly/1t6DhR']" update="upd">Ajax Link</g:remoteLink></h1> <p id="upd">I am the ajax element that gets updated</p>
- Differences between tag and service
The service doesn't catch exceptions while the tag does: The tag returns the input url param in case of an exception or an empty string. The is true even if the given url is invalid.
Simple usage example