faust.sacha.web.util
Class URLInfo

java.lang.Object
  |
  +--faust.sacha.web.util.URLInfo
Direct Known Subclasses:
URLData

public class URLInfo
extends java.lang.Object

Class that defines a HTTP url.


Constructor Summary
protected URLInfo()
           
  URLInfo(java.lang.String url)
           
  URLInfo(java.lang.String url, int urlType)
           
  URLInfo(java.lang.String url, URLInfo parentURL)
           
  URLInfo(java.lang.String url, URLInfo parentURL, int urlType)
           
 
Method Summary
 java.lang.String getAnchor()
           
 java.lang.String getBaseURL()
          Returns the base url for this url.
 java.lang.String getDirectURL()
          Returns the url without the cgi arguments and anchor.
 java.lang.String getFile()
          Returns the file part of the url.
 java.lang.String getFolder()
          Returns the folder peace of the url.
 java.lang.String getHost()
           
 java.lang.String getPath()
          Returns the path part of this url (folder/file).
 int getPort()
          Returns the port used by this url.
 java.lang.String getProtocol()
          Returns the protocol used by this url.
 java.lang.String getQuery()
          Returns the query part of this url.
 java.lang.String getURL()
          Returns the url in the following format: [protocol][domain][folder][file][script argument or anchor]
 int getURLType()
           
 java.lang.String getURLWithoutAnchor()
           
 boolean isSecure()
          Returns if the url reference to a HTTPS connection.
 boolean sameAs(URLInfo toCompare)
          This will compare two url reference to see if they refer to the same resource.
protected  boolean setBaseURLAndPathdAnchor()
           
protected  boolean setFolderAndFile()
           
protected  boolean setPortAndProtocolAndHost()
           
protected  void setQuery()
           
protected  void setQuery(java.lang.String query)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

URLInfo

protected URLInfo()

URLInfo

public URLInfo(java.lang.String url)
        throws java.net.MalformedURLException
Parameters:
url - The url that you want to define.
Throws:
java.net.MalformedURLException

URLInfo

public URLInfo(java.lang.String url,
               int urlType)
        throws java.net.MalformedURLException

URLInfo

public URLInfo(java.lang.String url,
               URLInfo parentURL)
        throws java.net.MalformedURLException
Parameters:
url - The url or peace of url that you want to define.
parentURL - The parent url that serves as the base of the url that you want to define.
Throws:
java.net.MalformedURLException

URLInfo

public URLInfo(java.lang.String url,
               URLInfo parentURL,
               int urlType)
        throws java.net.MalformedURLException
Method Detail

setBaseURLAndPathdAnchor

protected boolean setBaseURLAndPathdAnchor()
Returns:

setFolderAndFile

protected boolean setFolderAndFile()

setPortAndProtocolAndHost

protected boolean setPortAndProtocolAndHost()

setQuery

protected void setQuery()

setQuery

protected void setQuery(java.lang.String query)

getBaseURL

public java.lang.String getBaseURL()
Returns the base url for this url. The output is in the following format: [protocol][domain]:[port is different then 80 or 443 for https]. Example: The baseurl of http://site.com/folder/file.html is http://site.com/

Returns:
Get the base url as a String of this url.

getFolder

public java.lang.String getFolder()
Returns the folder peace of the url.

Returns:
The folder peace.

getFile

public java.lang.String getFile()
Returns the file part of the url.

Returns:
file part of this url.

getPath

public java.lang.String getPath()
Returns the path part of this url (folder/file).

Returns:
The path part of this url.

getPort

public int getPort()
Returns the port used by this url.

Returns:
The port used.

getProtocol

public java.lang.String getProtocol()
Returns the protocol used by this url.

Returns:
The protocol used by this url.

getQuery

public java.lang.String getQuery()
Returns the query part of this url.

Returns:
- If this urls reference a script, returns the argument string. - Else, returns null

getURL

public java.lang.String getURL()
Returns the url in the following format: [protocol][domain][folder][file][script argument or anchor]

Returns:
The full url.

getDirectURL

public java.lang.String getDirectURL()
Returns the url without the cgi arguments and anchor.

Returns:
The url without the arguments and anchor.

isSecure

public boolean isSecure()
Returns if the url reference to a HTTPS connection.

Returns:
- true if the url reference a https connection - false if it doesn't

getHost

public java.lang.String getHost()
Returns:
the host of this url.

sameAs

public boolean sameAs(URLInfo toCompare)
This will compare two url reference to see if they refer to the same resource.

Parameters:
toCompare - url to compare againts.
Returns:
- true if the url is the same. - fause if it's not.

getURLType

public int getURLType()
Returns:
the url type.

getAnchor

public java.lang.String getAnchor()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getURLWithoutAnchor

public java.lang.String getURLWithoutAnchor()