net.sourceforge.rssowl.util.shop
Class URLShop

java.lang.Object
  extended by net.sourceforge.rssowl.util.shop.URLShop

public class URLShop
extends java.lang.Object

Factory class for some URL concerns in RSSOwl

Version:
1.2.4
Author:
Benjamin Pasero

Field Summary
static java.lang.String ABOUT_BLANK
          Empty Browser Page
static java.lang.String AMPHETARATE_REGISTRATION_URL
          Following this URL a new AmphetaRate User ID is returned
private static java.lang.String[] BINARY_EXTENSIONS
          Common Binary file Extensions
private static java.lang.String ERROR_MAIL
          Mail alias of where to send the error report
private static java.lang.String[] FEED_EXTENSIONS
          Common Newsfeed Extensions
private static java.lang.String[] FEED_EXTENSIONS_DOTTED
          Common Newsfeed Extensions with leading Dot
static java.lang.String FEED_PROTOCOL_LONG
          The Long Feed Protocol URI Syntax
static java.lang.String FEED_PROTOCOL_SHORT
          The Short Feed Protocol URI Syntax
static java.lang.String FEED_VALIDATOR_URL
          URL for Validating Feeds on W3C
static java.lang.String RSSOWL_CHANGELOG_URL
          URL to receive newest version changelog
static java.lang.String RSSOWL_CONTACT
          RSSOwl eMail: Contact
static java.lang.String RSSOWL_DONATE
          RSSOwl Link: Donation
static java.lang.String RSSOWL_DOWNLOAD
          RSSOwl Link: Download
static java.lang.String RSSOWL_FAQ
          RSSOwl Link: FAQ (Newsfeed)
static java.lang.String RSSOWL_FEED
          RSSOwl Link: Newsfeed
static java.lang.String RSSOWL_FORUM
          RSSOwl Link: Discussion Forum
static java.lang.String RSSOWL_LIST
          RSSOwl Link: Mailinglist
static java.lang.String RSSOWL_PROMOTION
          RSSOwl Link: Promotion
static java.lang.String RSSOWL_TUTORIAL
          RSSOwl Link: Tutorial
static java.lang.String RSSOWL_UPDATE_URL
          URL to receive newest version information
static java.lang.String RSSOWL_WEBPAGE
          RSSOwl Link: Webpage
 
Constructor Summary
private URLShop()
          This utility class constructor is hidden
 
Method Summary
static java.lang.String canonicalize(java.lang.String simpleURL)
          Transform the given URL into canonical form.
static java.util.Vector crawlUrls(java.lang.String fromUrl)
          Try to crawl any URL from the given WebSite.
static java.lang.String createErrorReport()
          Create an error report to be sent as mail
static java.lang.String createTellMyFriends()
          Build the RSSOwl teaser in a "mailto:" link
static java.lang.String getFile(java.net.URL url)
          Try to get the File Name of the given URL.
static boolean hasProtocolName(java.lang.String url)
          Check if the given URL contains a protocol name
static boolean isScriptAllowed(java.lang.String location)
          Method to check wether JavaScript is allowed for the given Location.
static boolean isSimpleHostName(java.lang.String url)
          Check if the given URL only has a simple host name.
static boolean looksLikeBinary(java.lang.String str)
          Return TRUE in case the given URL includes onr of the common binary extensions.
static boolean looksLikeNewsfeed(java.lang.String str, boolean dotted)
          Return TRUE in case the given URL includes one of the common newsfeed extensions.
static boolean looksLikeNewsfeed(java.net.URL url, boolean dotted)
          Return TRUE in case the given URL includes one of the common newsfeed extensions.
static boolean looksLikeURL(java.lang.String str)
          Return TRUE in case the given String looks like an URL.
static java.lang.String mailToUrllEncode(java.lang.String str)
          URLEncode the given String.
static java.lang.String urlDecode(java.lang.String str)
          This is a simple wrapper method for the decode() Method of the URLDecoder.
static java.lang.String urlEncode(java.lang.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

ABOUT_BLANK

public static final java.lang.String ABOUT_BLANK
Empty Browser Page

See Also:
Constant Field Values

AMPHETARATE_REGISTRATION_URL

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


FEED_PROTOCOL_LONG

public static final java.lang.String FEED_PROTOCOL_LONG
The Long Feed Protocol URI Syntax

See Also:
Constant Field Values

FEED_PROTOCOL_SHORT

public static final java.lang.String FEED_PROTOCOL_SHORT
The Short Feed Protocol URI Syntax

See Also:
Constant Field Values

FEED_VALIDATOR_URL

public static final java.lang.String FEED_VALIDATOR_URL
URL for Validating Feeds on W3C

See Also:
Constant Field Values

RSSOWL_CHANGELOG_URL

public static java.lang.String RSSOWL_CHANGELOG_URL
URL to receive newest version changelog


RSSOWL_CONTACT

public static java.lang.String RSSOWL_CONTACT
RSSOwl eMail: Contact


RSSOWL_DONATE

public static java.lang.String RSSOWL_DONATE
RSSOwl Link: Donation


RSSOWL_DOWNLOAD

public static java.lang.String RSSOWL_DOWNLOAD
RSSOwl Link: Download


RSSOWL_FAQ

public static java.lang.String RSSOWL_FAQ
RSSOwl Link: FAQ (Newsfeed)


RSSOWL_FEED

public static java.lang.String RSSOWL_FEED
RSSOwl Link: Newsfeed


RSSOWL_FORUM

public static java.lang.String RSSOWL_FORUM
RSSOwl Link: Discussion Forum


RSSOWL_LIST

public static java.lang.String RSSOWL_LIST
RSSOwl Link: Mailinglist


RSSOWL_PROMOTION

public static java.lang.String RSSOWL_PROMOTION
RSSOwl Link: Promotion


RSSOWL_TUTORIAL

public static java.lang.String RSSOWL_TUTORIAL
RSSOwl Link: Tutorial


RSSOWL_UPDATE_URL

public static java.lang.String RSSOWL_UPDATE_URL
URL to receive newest version information


RSSOWL_WEBPAGE

public static java.lang.String RSSOWL_WEBPAGE
RSSOwl Link: Webpage


BINARY_EXTENSIONS

private static final java.lang.String[] BINARY_EXTENSIONS
Common Binary file Extensions


ERROR_MAIL

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

See Also:
Constant Field Values

FEED_EXTENSIONS

private static final java.lang.String[] FEED_EXTENSIONS
Common Newsfeed Extensions


FEED_EXTENSIONS_DOTTED

private static final java.lang.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 java.lang.String canonicalize(java.lang.String simpleURL)
Transform the given URL into canonical form.

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

crawlUrls

public static java.util.Vector crawlUrls(java.lang.String fromUrl)
                                  throws HttpException,
                                         java.io.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:
HttpException - In case of an error.
java.io.IOException - In case of an error.

createErrorReport

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

Returns:
String The mailto link for the mail

createTellMyFriends

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

Returns:
String The mailto: Link

getFile

public static java.lang.String getFile(java.net.URL url)
Try to get the File Name of the given URL.

Parameters:
url - The URL to parse the File from.
Returns:
String The File Name or the URL in external Form.

hasProtocolName

public static boolean hasProtocolName(java.lang.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(java.lang.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(java.lang.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(java.lang.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(java.net.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(java.lang.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 java.lang.String mailToUrllEncode(java.lang.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

urlDecode

public static java.lang.String urlDecode(java.lang.String str)
This is a simple wrapper method for the decode() Method of the URLDecoder. 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 decode
Returns:
String URL Decoded String

urlEncode

public static java.lang.String urlEncode(java.lang.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

isScriptAllowed

public static boolean isScriptAllowed(java.lang.String location)
Method to check wether JavaScript is allowed for the given Location.

Note: Only used on Windows!

Parameters:
location - The location (URL) as String.
Returns:
boolean TRUE in case JavaScript is allowed, FALSE otherwise.


RSSOwl - RSS / RDF / Atom Newsreader

SourceForge.net Logo