org.xmlBlaster.util
Class XbUri
java.lang.Object
org.xmlBlaster.util.XbUri
public class XbUri
- extends java.lang.Object
Convenience wrapper to parse an URI.
It supports to directly access the user and password.
smtp://joe:mypassword@server.xmlBlaster.org:3412
http://x.org:6000/mypath/?
http://server.xmlBlaster.org:3412/myPath#myFragment
http://server.xmlBlaster.org:3412/myPath?key.oid=MyMessage
http://server.xmlBlaster.org:3412/myPath/?key.oid=MyMessage
http://server.xmlBlaster.org:3412/myPath?key.oid=MyMessage#myFragment
http://joe:mypassword@server.xmlBlaster.org:3412/myPath?key.oid=MyMessage#myFragment
Protocol: http
Host: server.xmlBlaster.org
Port: 3412
File: /myPath?key.oid=MyMessage
Path: /myPath
Query: key.oid=MyMessage
Ref: myFragment
UserInfo: joe:mypassword
http:/myPath/?key.oid=MyMessage#myFragment
Protocol: http
Host:
Port: -1
File: /myPath/?key.oid=MyMessage
Path: /myPath/
Query: key.oid=MyMessage
Ref: myFragment
UserInfo: null
INVALID:
http://server.xmlBlaster.org:3412/myPath#myFragment?key.oid=MyMessage
getRef() == Fragment
Note: Using a '@' character in the username or password should
be written as '%40', but we handle the '@' as well to ease the use.
- See Also:
SocketUrl.java
Constructor Summary |
XbUri(java.lang.String uriStr)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
XbUri
public XbUri(java.lang.String uriStr)
throws java.net.URISyntaxException
- Throws:
java.net.URISyntaxException
getHost
public java.lang.String getHost()
- Returns:
- Returns the host.
getPassword
public java.lang.String getPassword()
- Returns:
- Returns the password, IS NULL if no password was given
getPath
public java.lang.String getPath()
- Returns:
- Returns the path.
getPort
public int getPort()
- Returns:
- Returns the port.
getQuery
public java.lang.String getQuery()
- Returns:
- Returns the query.
getScheme
public java.lang.String getScheme()
- Returns:
- Returns the scheme.
getUri
public java.net.URI getUri()
- Returns:
- Returns the uri.
getUser
public java.lang.String getUser()
- Returns:
- Returns the user.
getUserInfo
public java.lang.String getUserInfo()
- Returns:
- Returns the userInfo.
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
toLiteral
public java.lang.String toLiteral()
getUrlWithoutPassword
public java.lang.String getUrlWithoutPassword()
- Returns for example "pop3://demo@localhost:110/INBOX" which is extracted
from pop3Url="pop3://demo:secret@localhost:110/INBOX"
- Returns:
main
public static void main(java.lang.String[] args)
Copyright © 1999-2014 The xmlBlaster.org contributers.