public class CmsUriSplitter
extends java.lang.Object
An URI is splitted into a prefix
, a anchor
and a query
part.
构造器和说明 |
---|
CmsUriSplitter(java.lang.String uri)
Creates a splitted URI using the default (not strict) parsing mode.
|
CmsUriSplitter(java.lang.String uri,
boolean strict)
Creates a splitted URI using the given parsing mode.
|
限定符和类型 | 方法和说明 |
---|---|
boolean |
equals(java.lang.Object obj) |
java.lang.String |
getAnchor()
Returns the anchor part of the uri, for example
someanchor ,
or null if no anchor is available. |
java.lang.String |
getPrefix()
Returns the prefix part of the uri, for example
http://www.opencms.org/some/path/ ,
or null if no prefix is available. |
java.lang.String |
getProtocol()
Returns the URI protocol, for example
http or https . |
java.lang.String |
getQuery()
Returns the query part of the uri, for example
a=b&c=d ,
or null if no query is available. |
java.lang.String |
getSuffix()
Returns the suffix part of the uri, a combination of query and anchor,
for example
? |
java.lang.String |
getUri()
Returns the URI String passed to this URI splitter.
|
int |
hashCode() |
boolean |
isErrorFree()
Returns
true if the URI was parsed error free in 'strict' mode,
or if the simple mode was used. |
java.net.URI |
toURI()
Returns an URI object created from the original input String.
|
public CmsUriSplitter(java.lang.String uri)
uri
- the URI to splitpublic CmsUriSplitter(java.lang.String uri, boolean strict)
Using 'strict' parsing mode, all requirements for an URI are checked.
If 'strict' is set to false
, then only some simple parsing rules are applied,
in which case the result may not be 100% valid (but still usable).
If 'strict' parsing generates an error, then simple parsing is used as a fallback.
uri
- the URI to splitstrict
- if true
, then 'strict' parsing mode is used, otherwise a relaxed URI parsing is donepublic boolean equals(java.lang.Object obj)
equals
在类中 java.lang.Object
Object.equals(java.lang.Object)
public java.lang.String getAnchor()
someanchor
,
or null
if no anchor is available.public java.lang.String getProtocol()
http
or https
.public java.lang.String getPrefix()
http://www.opencms.org/some/path/
,
or null
if no prefix is available.public java.lang.String getQuery()
a=b&c=d
,
or null
if no query is available.public java.lang.String getSuffix()
?a=b&c=d#someanchor
,
or the empty String if no suffix is available.public java.lang.String getUri()
public int hashCode()
hashCode
在类中 java.lang.Object
Object.hashCode()
public boolean isErrorFree()
true
if the URI was parsed error free in 'strict' mode,
or if the simple mode was used.true
if the URI was parsed error free in 'strict' mode,
or if the simple mode was usedpublic java.net.URI toURI() throws java.net.URISyntaxException
This method will do a "best effort" to convert the original input String to a legal URI. Most notably, it will be able to handle original input Strings that contain a space " " and other usually illegal characters.
java.net.URISyntaxException
- in case no URI object can be created from the original input String