xmlBlaster 2.1.0 API

org.xmlBlaster.util
Class XbUri

java.lang.Object
  extended by 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

Field Summary
private  java.lang.String password
           
private  java.lang.String placeHolder
           
private  java.net.URI uri
           
private  java.lang.String user
           
 
Constructor Summary
XbUri(java.lang.String uriStr)
           
 
Method Summary
 java.lang.String getHost()
           
 java.lang.String getPassword()
           
 java.lang.String getPath()
           
 int getPort()
           
 java.lang.String getQuery()
           
 java.lang.String getScheme()
           
 java.net.URI getUri()
           
 java.lang.String getUrlWithoutPassword()
          Returns for example "pop3://demo@localhost:110/INBOX" which is extracted from pop3Url="pop3://demo:secret@localhost:110/INBOX"
 java.lang.String getUser()
           
 java.lang.String getUserInfo()
           
static void main(java.lang.String[] args)
           
private  void parse(java.lang.String uriStr)
           
 java.lang.String toLiteral()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

uri

private java.net.URI uri

user

private java.lang.String user

password

private java.lang.String password

placeHolder

private final java.lang.String placeHolder
See Also:
Constant Field Values
Constructor Detail

XbUri

public XbUri(java.lang.String uriStr)
      throws java.net.URISyntaxException
Throws:
java.net.URISyntaxException
Method Detail

parse

private void parse(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)

xmlBlaster 2.1.0 API

Copyright © 1999-2011 The xmlBlaster.org contributers.