public class HTMLPage
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected Link |
link
The original link to this page
|
protected java.util.List<Link> |
outLinks
The links on this page
|
protected java.lang.String |
text
The text of the page
|
Constructor and Description |
---|
HTMLPage(Link link,
java.lang.String text)
Constructs an
HTMLPage with the given link and text. |
Modifier and Type | Method and Description |
---|---|
protected static java.net.URL |
addEndSlash(java.net.URL url)
If URL looks like a directory rather than a file, then
add a "/" at the end so that it acts as a proper base URL
for completing URLs in this page
|
boolean |
empty()
Returns true if the page is empty or a 404 error.
|
Link |
getLink()
Returns the
Link object that was used to access
this page. |
java.util.List<Link> |
getOutLinks()
Get the list of out links from this page.
|
java.lang.String |
getText()
Returns the full text of this page.
|
boolean |
indexAllowed()
Clients should always call this method before indexing an HTML
page if they want to obey the "NOINDEX" directive in the Robots
META tag.
|
void |
setOutLinks(java.util.List<Link> links)
Set of the outLinks for this page to given list
|
void |
write(java.io.File dir,
java.lang.String name)
Writes web page to a file with a BASE HTML element with the
original URL.
|
protected final Link link
protected final java.lang.String text
protected java.util.List<Link> outLinks
public HTMLPage(Link link, java.lang.String text)
HTMLPage
with the given link and text.link
- Link
object to the given page.text
- The text of the page.public java.lang.String getText()
public Link getLink()
Link
object that was used to access
this page.Link
object that was used to access
this page.public void setOutLinks(java.util.List<Link> links)
public java.util.List<Link> getOutLinks()
public boolean indexAllowed()
true
in default implementation.true
iff. the page can be indexed. Always
returns true
in the default implementation.public boolean empty()
public void write(java.io.File dir, java.lang.String name)
dir
- The directory to store the file in.name
- The name of the file.protected static java.net.URL addEndSlash(java.net.URL url)