org.openprivacy.reptile
Class RelativizeContentParser

java.lang.Object
  |
  +--org.openprivacy.reptile.RelativizeContentParser

public class RelativizeContentParser
extends java.lang.Object

Given some input HTML, the resource URL of the HTML, we will take all , , etc links and make them full URLs (if they are partial)

Version:
$Id: RelativizeContentParser.java,v 1.5 2002/10/16 01:16:57 burton Exp $
Author:
burtonator

Constructor Summary
RelativizeContentParser()
           
 
Method Summary
 void addDependency(RelativizeDependency depend)
          Add the given resource as a dependency of the current HTML file.
 java.lang.String expand(java.lang.String link)
          Expand a link relavant to the current site.
 java.lang.String getBase()
          Get the base of this URL.
 RelativizeDependency[] getDependencies()
           
 java.lang.String getResource()
          Get the value of resource.
 java.lang.String getSite()
          Get the site for this resource.
 boolean isInvalidScheme(java.lang.String resource)
          Return true if this is an invalid scheme and should be expanded (javascript, mailto, etc)
 java.lang.String relativize(java.lang.String content)
          Used to fix relative links in HTML content so that everything is expanded.
 void setResource(java.lang.String resource)
          Set the value of resource.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RelativizeContentParser

public RelativizeContentParser()
Method Detail

getResource

public java.lang.String getResource()
Get the value of resource.


setResource

public void setResource(java.lang.String resource)
Set the value of resource.


getDependencies

public RelativizeDependency[] getDependencies()

relativize

public java.lang.String relativize(java.lang.String content)
                            throws java.lang.Exception
Used to fix relative links in HTML content so that everything is expanded.

java.lang.Exception

expand

public java.lang.String expand(java.lang.String link)
                        throws java.lang.Exception
Expand a link relavant to the current site. This takes care of links such as /foo.html -> http://site.com/base/foo.html foo.html -> http://site.com/base/foo.html Links should *always* be expanded before they are used. Note that all resource URLs will have correct trailing slashes. If the URL does not end with / then it is a file URL and not a directory.

java.lang.Exception

getBase

public java.lang.String getBase()
Get the base of this URL. For example if we are given: http://www.foo.com/directory/index.html we will return http://www.foo.com/directory


getSite

public java.lang.String getSite()
Get the site for this resource. For example: http://www.foo.com/directory/index.html we will return http://www.foo.com


addDependency

public void addDependency(RelativizeDependency depend)
Add the given resource as a dependency of the current HTML file.


isInvalidScheme

public boolean isInvalidScheme(java.lang.String resource)
Return true if this is an invalid scheme and should be expanded (javascript, mailto, etc)