com.livis.flabes.util
Class URLUtils
java.lang.Object
|
+--com.livis.flabes.util.URLUtils
- public class URLUtils
- extends java.lang.Object
Method Summary |
static boolean |
isRelative(java.lang.String urlSpec)
Check whether a given URL specification is
relative.
|
static java.lang.String |
relativeURLSpec(java.lang.String fromSpec,
java.lang.String toSpec,
java.lang.String[] contextSpecs)
Create string representation of a relative URL specifying the
path between two locations.
|
static java.lang.String |
trimProtocol(java.lang.String urlSpec)
|
static java.lang.String |
trimProtocols(java.lang.String urlSpec)
|
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
trimProtocol
public static java.lang.String trimProtocol(java.lang.String urlSpec)
trimProtocols
public static java.lang.String trimProtocols(java.lang.String urlSpec)
isRelative
public static boolean isRelative(java.lang.String urlSpec)
- Check whether a given
URL
specification is
relative.
All URLs which are not well-formed are considered relative.
- Parameters:
urlSpec
- string reperesentation of the URL to check
relativeURLSpec
public static java.lang.String relativeURLSpec(java.lang.String fromSpec,
java.lang.String toSpec,
java.lang.String[] contextSpecs)
throws java.net.MalformedURLException
- Create string representation of a relative URL specifying the
path between two locations.
fromSpec
and toSpec
are expected to
be relative to the same context, which should be omitted. If
one or both specifications are given absolute but relative to a
context URL specified in contextSpecs
, the context
prefix with the longest match is removed before contructing the
resulting link. Prefixes not mentioned in
contextSpecs
but common to fromSpec
and toSpec
are also removed.
- Parameters:
fromSpec
- string representation of the "from" locationtoSpec
- string representation of the "to" locationcontextSpecs
- string representations of locations "from"
and "to " may be relative to- Throws:
- java.net.MalformedURLException - if one of the
contextSpecs
is not
well-formed (null
references are allowed for
convenience)