org.openid4java.discovery.yadis
Class YadisUrl

java.lang.Object
  extended by org.openid4java.discovery.yadis.YadisUrl

public class YadisUrl
extends java.lang.Object

Wrapper class for various identifiers that are resolvable to URLs and can be used as YadisURLs with the Yadis protocol.

Author:
Marius Scurtescu, Johnny Bufu

Field Summary
private  java.net.URL _yadisUrl
          A YadisURL is a regular URL, with a couple restrictions.
 
Constructor Summary
YadisUrl(java.lang.String urlString)
          Contructs a YadisURL from a string; assumes the string to be a URL-type identifier
YadisUrl(java.net.URL urlId)
          Constructs a YadisURL from a URL object; insures the schema is HTTP or HTTPS
YadisUrl(XriIdentifier xriId)
          Constructs a YadisURL from an XRI identifier.
 
Method Summary
 java.net.URL getUrl()
          Gets the URL to be used in Yadis transactions.
private  boolean isValid(java.net.URL url)
          Validates a URL against the requirements for a YadisUrl.
 java.lang.String toString()
          Gets a string representation of the YadisURL.
private static java.net.URL urlFromString(java.lang.String urlString)
          Constructs a URL object from a string; needed by the YadisURL(String) constructor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_yadisUrl

private java.net.URL _yadisUrl
A YadisURL is a regular URL, with a couple restrictions.

Constructor Detail

YadisUrl

public YadisUrl(java.lang.String urlString)
         throws YadisException
Contructs a YadisURL from a string; assumes the string to be a URL-type identifier

Parameters:
urlString - URL-type identifier in string format
Throws:
YadisException - if the provided string cannot be a YadisUrl

YadisUrl

public YadisUrl(java.net.URL urlId)
         throws YadisException
Constructs a YadisURL from a URL object; insures the schema is HTTP or HTTPS

Parameters:
urlId - URL identifier
Throws:
YadisException - tf the URL identifier is not a valid YadisURL

YadisUrl

public YadisUrl(XriIdentifier xriId)
         throws YadisException
Constructs a YadisURL from an XRI identifier.

Parameters:
xriId - The XRI identifier
Throws:
YadisException
Method Detail

urlFromString

private static java.net.URL urlFromString(java.lang.String urlString)
                                   throws YadisException
Constructs a URL object from a string; needed by the YadisURL(String) constructor

Parameters:
urlString - URL-type identifier in string format
Returns:
URL object
Throws:
YadisException - if the provided string is not a valid URL

isValid

private boolean isValid(java.net.URL url)
Validates a URL against the requirements for a YadisUrl.

The URL must be absolute (the schema must be specified), and the schema must be HTTP or HTTPS.

Parameters:
url - the URL to be validated
Returns:
true if the URL is a valid YadisUrl, or false otherwise

getUrl

public java.net.URL getUrl()
Gets the URL to be used in Yadis transactions.


toString

public java.lang.String toString()
Gets a string representation of the YadisURL.

Overrides:
toString in class java.lang.Object


Copyright 2006-2008 Sxip Identity Corporation