public class

URLCanonicalizer

extends Object
java.lang.Object
   ↳ sun.net.URLCanonicalizer

Class Overview

Helper class to map URL "abbreviations" to real URLs. The default implementation supports the following mappings: ftp.mumble.bar/... => ftp://ftp.mumble.bar/... gopher.mumble.bar/... => gopher://gopher.mumble.bar/... other.name.dom/... => http://other.name.dom/... /foo/... => file:/foo/... Full URLs (those including a protocol name) are passed through unchanged. Subclassers can override or extend this behavior to support different or additional canonicalization policies.

Summary

Public Constructors
URLCanonicalizer()
Creates the default canonicalizer instance.
Public Methods
String canonicalize(String simpleURL)
Given a possibly abbreviated URL (missing a protocol name, typically), this method's job is to transform that URL into a canonical form, by including a protocol name and additional syntax, if necessary.
boolean hasProtocolName(String url)
Given a possibly abbreviated URL, this predicate function returns true if it appears that the URL contains a protocol name
Protected Methods
boolean isSimpleHostName(String url)
Returns true if the URL is just a single name, no periods or slashes, false otherwise
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public URLCanonicalizer ()

Creates the default canonicalizer instance.

Public Methods

public String canonicalize (String simpleURL)

Given a possibly abbreviated URL (missing a protocol name, typically), this method's job is to transform that URL into a canonical form, by including a protocol name and additional syntax, if necessary. For a correctly formed URL, this method should just return its argument.

public boolean hasProtocolName (String url)

Given a possibly abbreviated URL, this predicate function returns true if it appears that the URL contains a protocol name

Protected Methods

protected boolean isSimpleHostName (String url)

Returns true if the URL is just a single name, no periods or slashes, false otherwise