|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object lumis.portal.urlshortener.GoogleURLShortener
public class GoogleURLShortener
IURLShortener
that uses Google URL shortening service (Goo.gl). Besides the API URL, the Google service
requires an API key.
Field Summary | |
---|---|
static String |
PARAMETER_API_KEY
API key property bag key. |
static String |
PARAMETER_URL
This is the URL parameter to be used in API URLs. |
Constructor Summary | |
---|---|
GoogleURLShortener()
|
Method Summary | |
---|---|
String |
expand(String url)
Expands the given URL. |
String |
getApiKey()
Returns the API key from the parameters . |
protected String |
getApiURL()
Returns the URL shortener API URL to be used. |
protected String |
postData(String url)
Post data to Google's shortening service and returns the parsed shortened URL. |
String |
shorten(String url)
Shortens a given URL. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String PARAMETER_API_KEY
public static final String PARAMETER_URL
Constructor Detail |
---|
public GoogleURLShortener()
Method Detail |
---|
protected String getApiURL()
public String shorten(String url) throws PortalException
IURLShortener
shorten
in interface IURLShortener
url
- the URL to be shortened.
PortalException
- if some error occur in shortening process.protected String postData(String url) throws Exception
url
- the long URL.
Exception
public String getApiKey() throws PortalException
parameters
.
parameters
.
PortalException
- if the API key is not set in parameters
.public String expand(String url) throws PortalException
url
- the URL to be expanded.
PortalException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |