simplespider.simplespider.util
Class SimpleUrl

java.lang.Object
  extended by simplespider.simplespider.util.SimpleUrl

public class SimpleUrl
extends Object

this class exist to provide a system-wide normal form representation of urls, and to prevent that java.net.URL usage causes DNS queries which are used in java.net.

Based on de.anomic.yacy.yacyURL


Constructor Summary
SimpleUrl(SimpleUrl baseURL)
          Copy constructor
SimpleUrl(SimpleUrl baseURL, String relPath)
           
SimpleUrl(String url)
           
SimpleUrl(String protocol, String host, int port, String path)
           
 
Method Summary
 int compareTo(Object h)
           
 boolean equals(Object obj)
           
static String escape(String s)
          Encode a string to the "x-www-form-urlencoded" form, enhanced with the UTF-8-in-URL proposal.
 String getAuthority()
          Escapes the following parts of the url, this object already contains: path: see escape(String) ref: same as above quest: same as above without the ampersand ("&") and the equals symbol
 String getFile()
           
 String getFile(boolean includeReference)
           
 String getFileName()
           
 String getHost()
           
 String getPath()
           
 int getPort()
           
 String getProtocol()
           
 String getQuery()
           
 String getRef()
           
 String getUserInfo()
           
 int hashCode()
           
 boolean isCGI()
           
 boolean isPOST()
           
 String language()
           
static void main(String[] args)
           
static SimpleUrl newURL(SimpleUrl baseURL, String relPath)
           
static SimpleUrl newURL(String baseURL, String relPath)
           
 String toNormalform(boolean includeReference)
           
 String toNormalform(boolean includeReference, boolean stripAmp)
           
 String toString()
           
static String unescape(String s)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SimpleUrl

public SimpleUrl(SimpleUrl baseURL,
                 String relPath)
          throws MalformedURLException
Throws:
MalformedURLException

SimpleUrl

public SimpleUrl(String url)
          throws MalformedURLException
Throws:
MalformedURLException

SimpleUrl

public SimpleUrl(String protocol,
                 String host,
                 int port,
                 String path)
          throws MalformedURLException
Throws:
MalformedURLException

SimpleUrl

public SimpleUrl(SimpleUrl baseURL)
Copy constructor

Parameters:
baseURL - must not be null
Throws:
NullPointerException - if baseUrl is null
Method Detail

escape

public static String escape(String s)
Encode a string to the "x-www-form-urlencoded" form, enhanced with the UTF-8-in-URL proposal. This is what happens:

Parameters:
s - The string to be encoded
Returns:
The encoded string

main

public static void main(String[] args)

newURL

public static SimpleUrl newURL(SimpleUrl baseURL,
                               String relPath)
                        throws MalformedURLException
Throws:
MalformedURLException

newURL

public static SimpleUrl newURL(String baseURL,
                               String relPath)
                        throws MalformedURLException
Throws:
MalformedURLException

unescape

public static String unescape(String s)

compareTo

public int compareTo(Object h)

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

getAuthority

public String getAuthority()
Escapes the following parts of the url, this object already contains:


getFile

public String getFile()

getFile

public String getFile(boolean includeReference)

getFileName

public String getFileName()

getHost

public String getHost()

getPath

public String getPath()

getPort

public int getPort()

getProtocol

public String getProtocol()

getQuery

public String getQuery()

getRef

public String getRef()

getUserInfo

public String getUserInfo()

hashCode

public int hashCode()
Overrides:
hashCode in class Object

isCGI

public boolean isCGI()

isPOST

public boolean isPOST()

language

public String language()

toNormalform

public String toNormalform(boolean includeReference)

toNormalform

public String toNormalform(boolean includeReference,
                           boolean stripAmp)

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2009. All Rights Reserved.