Secure iNet Factory

com.jscape.inet.util
Class URLParser

java.lang.Object
  extended by com.jscape.inet.util.URLParser

public class URLParser
extends java.lang.Object

This class enables URL parsing for non-registered protocols. By default, many Java implementations would throw exception if one tries to run the following code:
URL url = new URL("https://www.jscape.com/"); In order to use the above code, a protocol handler must be installed for protocol 'https'. This is a procedure that is normally not allowed to client applet or application due to security restrictions.
Hence, this class provides the code necessary to parse the common URL representations regardless of the protocols installed on client computer. It is primarity oriented towards http-like URL's.

See Also:
URL

Field Summary
static java.util.Properties protocols
           
 
Constructor Summary
URLParser(java.lang.String url)
          Create URLParser and parse url fields.
 
Method Summary
 java.lang.String getAuthority()
          Get the authentication information for this URL.
 java.lang.String getFile()
          Get the file name for this URL.
 java.lang.String getHost()
          Get the host name for this URL.
 java.lang.String getPath()
          Get the path for this URL.
 int getPort()
          Get the port number for this URL.
 java.lang.String getProtocol()
          Get the protocol for this URL.
 java.lang.String getQuery()
          Get the query part of this URL.
 java.lang.String getReference()
          Get the reference part of this URL.
 java.lang.String getURLString()
          Gets the original URL string.
 void parse(java.lang.String url)
          Parse url fields.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

protocols

public static java.util.Properties protocols
Constructor Detail

URLParser

public URLParser(java.lang.String url)
          throws java.net.MalformedURLException
Create URLParser and parse url fields.

Parameters:
url - String representation of the URL to parse
Throws:
java.net.MalformedURLException - if the URL could not be parsed
Method Detail

parse

public void parse(java.lang.String url)
           throws java.net.MalformedURLException
Parse url fields.

Parameters:
url - String representation of the URL to parse
Throws:
java.net.MalformedURLException - if the URL could not be parsed

getHost

public java.lang.String getHost()
Get the host name for this URL.

Returns:
The host name parsed from the URL string.
See Also:
URL.getHost()

getPort

public int getPort()
Get the port number for this URL.

Returns:
The port number parsed from the URL string.
See Also:
URL.getPort()

getPath

public java.lang.String getPath()
Get the path for this URL.

Returns:
The path parsed from the URL string.
See Also:
URL.getPath()

getFile

public java.lang.String getFile()
Get the file name for this URL.

Returns:
The file name parsed from the URL string.
See Also:
URL.getFile()

getAuthority

public java.lang.String getAuthority()
Get the authentication information for this URL.

Returns:
The authentication info parsed from the URL string.
See Also:
URL.getAuthority()

getProtocol

public java.lang.String getProtocol()
Get the protocol for this URL.

Returns:
The protocol parsed from the URL string.
See Also:
URL.getProtocol()

getQuery

public java.lang.String getQuery()
Get the query part of this URL.

Returns:
The query parsed from the URL string.
See Also:
URL.getQuery()

getReference

public java.lang.String getReference()
Get the reference part of this URL.

Returns:
The reference parsed from the URL string.

getURLString

public java.lang.String getURLString()
Gets the original URL string.

Returns:
the original URL

Secure iNet Factory

Copyright © JSCAPE LLC. 1999-2011. All Rights Reserved