net.sourceforge.rssowl.util.shop
Class URLShop

java.lang.Object
  extended bynet.sourceforge.rssowl.util.shop.URLShop

public class URLShop
extends Object

Factory class for some URL concerns in RSSOwl

Version:
1.1.3
Author:
Benjamin Pasero

Field Summary
static String AMPHETARATE_REGISTRATION_URL
          Following this URL a new AmphetaRate User ID is returned
private static String[] BINARY_EXTENSIONS
          Common Binary file Extensions
private static String ERROR_MAIL
          Mail alias of where to send the error report
private static String[] FEED_EXTENSIONS
          Common Newsfeed Extensions
private static String[] FEED_EXTENSIONS_DOTTED
          Common Newsfeed Extensions with leading Dot
static String RSSOWL_CHANGELOG_URL
          URL to receive newest version changelog
static String RSSOWL_CONTACT
          RSSOwl eMail: Contact
static String RSSOWL_DONATE
          RSSOwl Link: Donation
static String RSSOWL_DOWNLOAD
          RSSOwl Link: Download
static String RSSOWL_FAQ
          RSSOwl Link: FAQ (Newsfeed)
static String RSSOWL_FEED
          RSSOwl Link: Newsfeed
static String RSSOWL_FORUM
          RSSOwl Link: Discussion Forum
static String RSSOWL_LIST
          RSSOwl Link: Mailinglist
static String RSSOWL_PROMOTION
          RSSOwl Link: Promotion
static String RSSOWL_TUTORIAL
          RSSOwl Link: Tutorial
static String RSSOWL_UPDATE_URL
          URL to receive newest version information
static String RSSOWL_WEBPAGE
          RSSOwl Link: Webpage
 
Constructor Summary
private URLShop()
          This utility class constructor is hidden
 
Method Summary
static String canonicalize(String simpleURL)
          Transform the given URL into canonical form.
static Vector crawlUrls(String fromUrl)
          Try to crawl any URL from the given WebSite.
static String createErrorReport()
          Create an error report to be sent as mail
static String createTellMyFriends()
          Build the RSSOwl teaser in a "mailto:" link
static boolean hasProtocolName(String url)
          Check if the given URL contains a protocol name
static boolean isSimpleHostName(String url)
          Check if the given URL only has a simple host name.
static boolean looksLikeBinary(String str)
          Return TRUE in case the given URL includes onr of the common binary extensions.
static boolean looksLikeNewsfeed(String str, boolean dotted)
          Return TRUE in case the given URL includes one of the common newsfeed extensions.
static boolean looksLikeNewsfeed(URL url, boolean dotted)
          Return TRUE in case the given URL includes one of the common newsfeed extensions.
static boolean looksLikeURL(String str)
          Return TRUE in case the given String looks like an URL.
static String mailToUrllEncode(String str)
          URLEncode the given String.
static String urlEncode(String str)
          This is a simple wrapper method for the encode() Method of the URLEncoder.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

AMPHETARATE_REGISTRATION_URL

public static String AMPHETARATE_REGISTRATION_URL
Following this URL a new AmphetaRate User ID is returned


RSSOWL_CHANGELOG_URL

public static String RSSOWL_CHANGELOG_URL
URL to receive newest version changelog


RSSOWL_CONTACT

public static String RSSOWL_CONTACT
RSSOwl eMail: Contact


RSSOWL_DONATE

public static String RSSOWL_DONATE
RSSOwl Link: Donation


RSSOWL_DOWNLOAD

public static String RSSOWL_DOWNLOAD
RSSOwl Link: Download


RSSOWL_FAQ

public static String RSSOWL_FAQ
RSSOwl Link: FAQ (Newsfeed)


RSSOWL_FEED

public static String RSSOWL_FEED
RSSOwl Link: Newsfeed


RSSOWL_FORUM

public static String RSSOWL_FORUM
RSSOwl Link: Discussion Forum


RSSOWL_LIST

public static String RSSOWL_LIST
RSSOwl Link: Mailinglist


RSSOWL_PROMOTION

public static String RSSOWL_PROMOTION
RSSOwl Link: Promotion


RSSOWL_TUTORIAL

public static String RSSOWL_TUTORIAL
RSSOwl Link: Tutorial


RSSOWL_UPDATE_URL

public static String RSSOWL_UPDATE_URL
URL to receive newest version information


RSSOWL_WEBPAGE

public static String RSSOWL_WEBPAGE
RSSOwl Link: Webpage


BINARY_EXTENSIONS

private static final String[] BINARY_EXTENSIONS
Common Binary file Extensions


ERROR_MAIL

private static final String ERROR_MAIL
Mail alias of where to send the error report

See Also:
Constant Field Values

FEED_EXTENSIONS

private static final String[] FEED_EXTENSIONS
Common Newsfeed Extensions


FEED_EXTENSIONS_DOTTED

private static final String[] FEED_EXTENSIONS_DOTTED
Common Newsfeed Extensions with leading Dot

Constructor Detail

URLShop

private URLShop()
This utility class constructor is hidden

Method Detail

canonicalize

public static String canonicalize(String simpleURL)
Transform the given URL into canonical form.

Parameters:
simpleURL - The URL to canonicalize
Returns:
String canonicalized URL

crawlUrls

public static Vector crawlUrls(String fromUrl)
                        throws org.apache.commons.httpclient.HttpException,
                               IOException
Try to crawl any URL from the given WebSite.

Parameters:
fromUrl - The URL of the WebSite to crawl URLs from.
Returns:
Vector A Collection containing all found URLs as Strings.
Throws:
org.apache.commons.httpclient.HttpException - In case of an error.
IOException - In case of an error.

createErrorReport

public static String createErrorReport()
Create an error report to be sent as mail

Returns:
String The mailto link for the mail

createTellMyFriends

public static String createTellMyFriends()
Build the RSSOwl teaser in a "mailto:" link

Returns:
String The mailto: Link

hasProtocolName

public static boolean hasProtocolName(String url)
Check if the given URL contains a protocol name

Parameters:
url - The URL to check
Returns:
boolean TRUE if the URL has a protocol name

isSimpleHostName

public static boolean isSimpleHostName(String url)
Check if the given URL only has a simple host name.

Parameters:
url - The URL to check
Returns:
boolean TRUE if the URL is a simple host name

looksLikeBinary

public static boolean looksLikeBinary(String str)
Return TRUE in case the given URL includes onr of the common binary extensions.

Parameters:
str - The URL to check
Returns:
TRUE in case the URL looks like a binary

looksLikeNewsfeed

public static boolean looksLikeNewsfeed(String str,
                                        boolean dotted)
Return TRUE in case the given URL includes one of the common newsfeed extensions.

Parameters:
str - The URL to check
dotted - If TRUE use extensions with leading dot
Returns:
TRUE in case the URL looks like a newsfeed

looksLikeNewsfeed

public static boolean looksLikeNewsfeed(URL url,
                                        boolean dotted)
Return TRUE in case the given URL includes one of the common newsfeed extensions.

Parameters:
url - The URL to check
dotted - If TRUE use extensions with leading dot
Returns:
TRUE in case the URL looks like a newsfeed

looksLikeURL

public static boolean looksLikeURL(String str)
Return TRUE in case the given String looks like an URL.

Parameters:
str - The String to check
Returns:
TRUE in case the String looks like an URL

mailToUrllEncode

public static String mailToUrllEncode(String str)
URLEncode the given String. Note that URLEncoder uses "+" to display any spaces. But we need "%20", so we'll replace all "+" with "%20". This method is used to create a "mailto:" URL that is handled by a mail application. The String is HTML Encoded if the user has set so.

Parameters:
str - String to encode
Returns:
String encoded String

urlEncode

public static String urlEncode(String str)
This is a simple wrapper method for the encode() Method of the URLEncoder. It uses RSSOwl's char encoding, which is UTF-8 by default, or any other supported charset set by the user.

Parameters:
str - String to encode
Returns:
String URL Encoded String


RSSOwl - RSS / RDF / Atom Newsreader

SourceForge.net Logo