Java Doc for LinkTransformer.java in  » Web-Crawler » WebSPHINX » websphinx » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Web Crawler » WebSPHINX » websphinx 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   websphinx.HTMLTransformer
      websphinx.LinkTransformer

All known Subclasses:   websphinx.RewritableLinkTransformer,  websphinx.Mirror,
LinkTransformer
public class LinkTransformer extends HTMLTransformer (Code)
Transformer that remaps URLs in links.

The default LinkTransformer simply converts all links to absolute URLs. Other common effects are easy to achieve:

  • To make all links relative to a base URL, use setBase() to set a base URL.
  • To replace certain URLs with different ones, use map() to set up the mappings.
The default LinkTransformer strips out <BASE> elements. Instead, it can output a <BASE> element with a user-specified URL. Use setBase() to set the URL and setEmitBaseElement() to indicate that it should be emitted.


Field Summary
protected  URLbase
    
 booleanemitBaseElement
    
protected  Hashtablemap
    
 booleanneedToEmitBase
    

Constructor Summary
public  LinkTransformer(String filename)
     Make a LinkTransformer writing to a file.
public  LinkTransformer(String filename, boolean seekable)
     Make a LinkTransformer that writes pages to a file.
public  LinkTransformer(OutputStream out)
     Make a LinkTransformer writing to a stream.
public  LinkTransformer(HTMLTransformer next)
    

Method Summary
public  URLgetBase()
     Get the base URL used by the LinkTransformer. A transformed link's URL is written out relative to this URL.
public  booleangetEmitBaseElement()
     Test whether the LinkTransformer should emit a <BASE> element pointing to the base URL.
protected  voidhandleBase(Element elem)
     Handle the BASE element.
protected  voidhandleElement(Element elem)
     Handle an element written through the transformer.
protected  voidhandleLink(Link link)
     Handle a Link's transformation.
public  booleanisMapped(URL url)
     Test whether a URL is mapped.
public  Stringlookup(URL base, URL url)
     Look up the href for a URL, taking any mapping into account.
public synchronized  voidmap(URL url, String href)
     Map a URL to an href.
public synchronized  voidmap(URL url, URL newURL)
     Map a URL to a new URL.
public synchronized  voidsetBase(URL base)
     Set the base URL used by the LinkTransformer. A transformed link's URL is written out relative to this URL.
public synchronized  voidsetEmitBaseElement(boolean emitBase)
     Set whether the LinkTransformer should emit a <BASE> element pointing to the base URL.
public synchronized  voidwritePage(Page page)
     Write a page through the transformer.

Field Detail
base
protected URL base(Code)



emitBaseElement
boolean emitBaseElement(Code)



map
protected Hashtable map(Code)



needToEmitBase
boolean needToEmitBase(Code)




Constructor Detail
LinkTransformer
public LinkTransformer(String filename) throws IOException(Code)
Make a LinkTransformer writing to a file.
Parameters:
  filename - Filename to write to



LinkTransformer
public LinkTransformer(String filename, boolean seekable) throws IOException(Code)
Make a LinkTransformer that writes pages to a file.
Parameters:
  filename - Name of file to receive HTML output
Parameters:
  seekable - True if file should be opened for random access



LinkTransformer
public LinkTransformer(OutputStream out)(Code)
Make a LinkTransformer writing to a stream.
Parameters:
  out - stream to write to



LinkTransformer
public LinkTransformer(HTMLTransformer next)(Code)
Make a LinkTransformer writing to another HTMLTransformer
Parameters:
  next - next transformer in filter chain




Method Detail
getBase
public URL getBase()(Code)
Get the base URL used by the LinkTransformer. A transformed link's URL is written out relative to this URL. For instance, if the base URL is http://www.yahoo.com/Entertainment/, then a link URL http://www.yahoo.com/News/Current/ would be written out as ../News/Current/. base URL, or null if no base URL is set. Default is null.



getEmitBaseElement
public boolean getEmitBaseElement()(Code)
Test whether the LinkTransformer should emit a <BASE> element pointing to the base URL. true if a <BASE> element should beemitted with each page.



handleBase
protected void handleBase(Element elem) throws IOException(Code)
Handle the BASE element. Default implementation removes if if EmitBaseElement is false, or changes its URL to Base if EmitBaseElement is true.
Parameters:
  elem - BASE element to transform



handleElement
protected void handleElement(Element elem) throws IOException(Code)
Handle an element written through the transformer. Remaps attributes that contain URLs.
Parameters:
  elem - Element to transform



handleLink
protected void handleLink(Link link) throws IOException(Code)
Handle a Link's transformation. Default implementation replaces the link's URL with lookup(URL).
Parameters:
  link - Link to transform



isMapped
public boolean isMapped(URL url)(Code)
Test whether a URL is mapped.
Parameters:
  url - URL of interest true if map () was called to remap url



lookup
public String lookup(URL base, URL url)(Code)
Look up the href for a URL, taking any mapping into account.
Parameters:
  base - base URL (or null if an absolute URL is desired)
Parameters:
  url - URL of interest relative href for url from base



map
public synchronized void map(URL url, String href)(Code)
Map a URL to an href. For example, Concatenator uses this call to map page URLs to their corresponding anchors in the concatenation.
Parameters:
  url - URL of interest
Parameters:
  href - href which should be returned by lookup (null, url)



map
public synchronized void map(URL url, URL newURL)(Code)
Map a URL to a new URL. For example, Mirror uses this call to map remote URLs to their corresponding local URLs.
Parameters:
  url - URL of interest
Parameters:
  newURL - URL which should be returned by lookup (null, url)



setBase
public synchronized void setBase(URL base)(Code)
Set the base URL used by the LinkTransformer. A transformed link's URL is written out relative to this URL. For instance, if the base URL is http://www.yahoo.com/Entertainment/, then a link URL http://www.yahoo.com/News/Current/ would be written out as ../News/Current/.
Parameters:
  base - base URL, or null if no base URL should be used.



setEmitBaseElement
public synchronized void setEmitBaseElement(boolean emitBase)(Code)
Set whether the LinkTransformer should emit a <BASE> element pointing to the base URL.
Parameters:
  emitBase - true if a <BASE> element should beemitted with each page.



writePage
public synchronized void writePage(Page page) throws IOException(Code)
Write a page through the transformer. If getEmitBaseElement() is true and getBase() is non-null, then the transformer outputs a <BASE> element either inside the page's <HEAD> element (if present) or before the first tag that belongs in <BODY>.
Parameters:
  page - Page to write



Methods inherited from websphinx.HTMLTransformer
public synchronized void close() throws IOException(Code)(Java Doc)
protected void emit(Region r) throws IOException(Code)(Java Doc)
protected void emit(String string) throws IOException(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
public synchronized void flush() throws IOException(Code)(Java Doc)
public long getFilePointer() throws IOException(Code)(Java Doc)
public OutputStream getOutputStream()(Code)(Java Doc)
public Writer getOutputWriter()(Code)(Java Doc)
public RandomAccessFile getRandomAccessFile()(Code)(Java Doc)
protected void handleElement(Element elem) throws IOException(Code)(Java Doc)
public void seek(long pos) throws IOException(Code)(Java Doc)
public void setOutput(OutputStream out)(Code)(Java Doc)
public void setRandomAccessFile(RandomAccessFile raf)(Code)(Java Doc)
protected void transformContents(Element elem) throws IOException(Code)(Java Doc)
protected void transformElement(Element elem) throws IOException(Code)(Java Doc)
public synchronized void write(String string) throws IOException(Code)(Java Doc)
public synchronized void write(Region region) throws IOException(Code)(Java Doc)
public synchronized void writePage(Page page) throws IOException(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.