Java Doc for URLScraperProvider.java in  » Portal » Open-Portal » com » sun » portal » providers » urlscraper » 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 » Portal » Open Portal » com.sun.portal.providers.urlscraper 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


com.sun.portal.providers.ProfileProviderAdapter
   com.sun.portal.providers.urlscraper.URLScraperProvider

All known Subclasses:   com.sun.portal.providers.xml.XMLProvider,
URLScraperProvider
public class URLScraperProvider extends ProfileProviderAdapter implements ProviderProperties(Code)

A URLScraperProvider is a content provider that can retrieve and display content from a given URL.

URLScraperProvider acts as an HTTP client and makes a request for the content of the specified URL and then displays it in the channel.

Each URLScraper channel has its own timeout attribute. The channel will wait up to its individual timeout to receive content.

Forwarding of cookies
Each URLScraper channel has a cookiesToForwardList attribute that can be set on the in the display profile. If a cookie is allowed by this attribute, a cookie in the request coming from the browser will be forwarded to the web server specified for the URL. allCookies attribute can be set to true to allow all the cookies. A set-cookie request from that web server will be sent back to the browser. The set-cookie request is modified so that the cookie is only sent back to the portal server.

URL Rewriting
The content gathered by the channel will be rewritten if the rewriter is available. The ruleset used by the rewriter can be specified in the display profile attribute rulesetID. Relative URLs are converted to absolute URLs. For example, if your portal server is http://portal.iplanet.com/ and the web server specified in the URL is http://foo.sesta.com/ and the file contains

<IMG SRC="/images/blah.gif">

then the content sent back to browser via portal server will be rewritten as:

<IMG SRC="http://foo.sesta.com/images/blah.gif">

Because otherwise the browser will attempt to read the image from http://portal.sesta.com/images/blah.gif and will not resolve it.

SSL protected pages
In general the URLScraperProvider will work with SSL pages. The important thing to remember is that there can be no level of interaction required by the specified URL as there is no way to pass that information to the end user.

  • The certificate on the target server needs to be valid (in other words signed by a recognized CA) If you browse to the specified URL and get a warning dialog about an expired or unrecognized certificate, the URLScraperProvider will not be able to access the site because it cannot respond to the dialogs.
  • There may be difficulties with sites that require 128-bit SSL.

Timeouts
There are 2 timeout values to consider:

  • URLScraper timeout (specific to the channel)
  • RefreshTime (attribute for all channels)
Each URLScraper channel has its own timeout attribute. The channel will wait up to its individual timeout to receive content.

Encoding
The order for determining the encoding would be HTTP header, if available (only applies to http(s) urls)
inputEncoding property, if non-blank
tag in content, e.g. meta tag in html & wml, xml header for xml, if available (only applies to HTML, XML,WML determined based on the MIMEType)
system default
MIMEType is determined from the jvm table. If not set, it is determined from the file extension.

Proxy Configuration
URLScraper channel uses a proxy to scrape the url specified if the proxy is set in jvm12.conf file for web server For Example the proxy can be set as
http.proxyHost=
http.proxyPort=

The refreshTime attribute is used for caching and will cause the URL not to be fetched again if the page is reloaded within that time.



Field Summary
protected static  StringtypeTable
    

Constructor Summary
public  URLScraperProvider()
     Default constructor.

Method Summary
public  StringBuffergetContent(HttpServletRequest req, HttpServletResponse res)
    

Get the provider's content by retrieving content from specified URL. This method internally calls getHttpContent when the url returned from getURL() is a http or https url. This method wraps certain exceptions thrown, into an error message to display as the channel content.
Parameters:
  req - An HttpServletRequest that contains information relatedto this request for content.
Parameters:
  res - An HttpServletResponse that allows the provider toinfluence the overall response for the desktop page(besides generating the content).

protected  booleangetCookiesToForwardAll()
    
public  StringBuffergetEdit(HttpServletRequest req, HttpServletResponse res)
    
protected  FilegetFile(String pathname)
     This method is called by getContent() if the url returned by getURL() is a file url.
protected  StringBuffergetFileAsBuffer(String pathName)
     Gets the specified file as StringBuffer
Parameters:
  path - specifying fully qualified pathname of the file.
protected  StringgetFormData()
    
protected  StringgetHttpAuthPassword()
    
protected  StringgetHttpAuthUid()
    
protected  StringBuffergetHttpContent(HttpServletRequest req, HttpServletResponse res, String url)
    

Get the provider's content by retrieving content from the specified http or https URL.

This method does not handle file URLs.

protected  StringBuffergetHttpContent(HttpServletRequest req, HttpServletResponse res, String url, boolean ubt)
    

Get the provider's content by retrieving content from the specified http or https URL.

This method does not handle file URLs.

public  StringgetInputEncoding()
    

Gets the inputEncoding to be used by content.

protected  StringgetLoginFormData()
    
protected  StringgetLoginUrl()
    
protected  StringgetLogoutUrl()
    
protected  StringgetRuleSetID()
    

Gets the urlScraperRulesetID to be used by rewriter.

protected  intgetTimeout()
     Gets the timeout property for the provider.
protected  StringgetURL()
    

Gets the url property for the provider.

protected  ListgetcookiesToForwardList()
    
protected  booleanisHttpAuth()
    
public  booleanisPresentable(HttpServletRequest request)
     Determines presentability for channels based on this provider.
public  URLprocessEdit(HttpServletRequest req, HttpServletResponse res)
    

Field Detail
typeTable
protected static String typeTable(Code)
Array of File extensions mapped to the MIMETypes




Constructor Detail
URLScraperProvider
public URLScraperProvider()(Code)
Default constructor.




Method Detail
getContent
public StringBuffer getContent(HttpServletRequest req, HttpServletResponse res) throws ProviderException(Code)

Get the provider's content by retrieving content from specified URL. This method internally calls getHttpContent when the url returned from getURL() is a http or https url. This method wraps certain exceptions thrown, into an error message to display as the channel content.
Parameters:
  req - An HttpServletRequest that contains information relatedto this request for content.
Parameters:
  res - An HttpServletResponse that allows the provider toinfluence the overall response for the desktop page(besides generating the content). Channel content
exception:
  ProviderException - if there was an error generating thecontent.
See Also:   com.sun.portal.providers.ProviderException
See Also:   URLScraperProvider.getHttpContent
See Also:   URLScraperProvider.getURL




getCookiesToForwardAll
protected boolean getCookiesToForwardAll() throws ProviderException(Code)



getEdit
public StringBuffer getEdit(HttpServletRequest req, HttpServletResponse res) throws ProviderException(Code)



getFile
protected File getFile(String pathname)(Code)
This method is called by getContent() if the url returned by getURL() is a file url.
Parameters:
  pathName - Fully qualified path name of file File Object specified by the pathName or nullif the file does not exists or cannot be read.



getFileAsBuffer
protected StringBuffer getFileAsBuffer(String pathName) throws IOException, ProviderException(Code)
Gets the specified file as StringBuffer
Parameters:
  path - specifying fully qualified pathname of the file. StringBuffer containing the data from the specified fileor null if file does not exist or cannot be read.
exception:
  IOException -
exception:
  ProviderException - if there is an error getting the fileas StringBuffer.
See Also:   com.sun.portal.providers.ProviderException



getFormData
protected String getFormData() throws ProviderException(Code)



getHttpAuthPassword
protected String getHttpAuthPassword() throws ProviderException(Code)



getHttpAuthUid
protected String getHttpAuthUid() throws ProviderException(Code)



getHttpContent
protected StringBuffer getHttpContent(HttpServletRequest req, HttpServletResponse res, String url) throws InterruptedException, MalformedURLException, ProviderException(Code)

Get the provider's content by retrieving content from the specified http or https URL.

This method does not handle file URLs. It only handles http or https urls. The content scraped from the specified url is rewritten if a rewriter is available using the ruleset returned by getRuleSetID()

This method throws exceptions for certain exceptional conditions instead of returning an error message in the returned StringBuffer
Parameters:
  req - An HttpServletRequest that contains information relatedto this request for content.
Parameters:
  res - An HttpServletResponse that allows the provider toinfluence the overall response for the desktop page(besides generating the content).
Parameters:
  url - http or https url string Scraped content
exception:
  InterruptedException - if there is a timeout whiletrying to get the scraped content
exception:
  MalformedURLException - if the url passed in is not a validhttp or https url.
exception:
  ProviderException - if there was an error generating thecontent
See Also:   com.sun.portal.providers.ProviderException
See Also:   URLScraperProvider.getRuleSetID




getHttpContent
protected StringBuffer getHttpContent(HttpServletRequest req, HttpServletResponse res, String url, boolean ubt) throws InterruptedException, MalformedURLException, ProviderException(Code)

Get the provider's content by retrieving content from the specified http or https URL.

This method does not handle file URLs. It only handles http or https urls. The content scraped from the specified url is rewritten if a rewriter is available using the ruleset returned by getRuleSetID()

This method throws exceptions for certain exceptional conditions instead of returning an error message in the returned StringBuffer
Parameters:
  req - An HttpServletRequest that contains information relatedto this request for content.
Parameters:
  res - An HttpServletResponse that allows the provider toinfluence the overall response for the desktop page(besides generating the content).
Parameters:
  url - http or https url string
Parameters:
  ubt - Indicates whether to track links external to portal Scraped content
exception:
  InterruptedException - if there is a timeout whiletrying to get the scraped content
exception:
  MalformedURLException - if the url passed in is not a validhttp or https url.
exception:
  ProviderException - if there was an error generating thecontent
See Also:   com.sun.portal.providers.ProviderException
See Also:   URLScraperProvider.getRuleSetID




getInputEncoding
public String getInputEncoding() throws ProviderException(Code)

Gets the inputEncoding to be used by content. This method returns the inputEncoding which would be used in encoding the scraped content. String value
exception:
  ProviderException - if there is an error getting theinput encoding.
See Also:   com.sun.portal.providers.ProviderException




getLoginFormData
protected String getLoginFormData() throws ProviderException(Code)



getLoginUrl
protected String getLoginUrl() throws ProviderException(Code)



getLogoutUrl
protected String getLogoutUrl() throws ProviderException(Code)



getRuleSetID
protected String getRuleSetID() throws ProviderException(Code)

Gets the urlScraperRulesetID to be used by rewriter. String value
exception:
  ProviderException - if there is an error getting theurlScrapperRulesetID.
See Also:   com.sun.portal.providers.ProviderException




getTimeout
protected int getTimeout() throws ProviderException(Code)
Gets the timeout property for the provider. timeout value
exception:
  ProviderException - if there is an error getting the timeoutproperty.
See Also:   com.sun.portal.providers.ProviderException



getURL
protected String getURL() throws ProviderException(Code)

Gets the url property for the provider. This is the URL from where the contents are fetched URL value
exception:
  ProviderException - if there is an error getting the URLproperty.
See Also:   com.sun.portal.providers.ProviderException




getcookiesToForwardList
protected List getcookiesToForwardList() throws ProviderException(Code)



isHttpAuth
protected boolean isHttpAuth() throws ProviderException(Code)



isPresentable
public boolean isPresentable(HttpServletRequest request)(Code)
Determines presentability for channels based on this provider. This overrides the base class's implementation to returns true for all device
Parameters:
  request - the HttpServletRequest boolean true for all devices



processEdit
public URL processEdit(HttpServletRequest req, HttpServletResponse res) throws ProviderException(Code)



Methods inherited from com.sun.portal.providers.ProfileProviderAdapter
public boolean existsBooleanProperty(String name) throws ProviderException(Code)(Java Doc)
public boolean existsIntegerProperty(String name) throws ProviderException(Code)(Java Doc)
public boolean existsListProperty(String name) throws ProviderException(Code)(Java Doc)
public boolean existsListProperty(String name, boolean localized) throws ProviderException(Code)(Java Doc)
public boolean existsStringProperty(String name) throws ProviderException(Code)(Java Doc)
public boolean existsStringProperty(String name, boolean localized) throws ProviderException(Code)(Java Doc)
public boolean getBooleanProperty(String key) throws ProviderException(Code)(Java Doc)
public boolean getBooleanProperty(String key, List pflist) throws ProviderException(Code)(Java Doc)
public boolean getBooleanProperty(String key, boolean def) throws ProviderException(Code)(Java Doc)
public boolean getBooleanProperty(String key, boolean def, List pflist) throws ProviderException(Code)(Java Doc)
public String getClientProperty(String name)(Code)(Java Doc)
public int getIntegerProperty(String key) throws ProviderException(Code)(Java Doc)
public int getIntegerProperty(String key, List pflist) throws ProviderException(Code)(Java Doc)
public int getIntegerProperty(String key, int def) throws ProviderException(Code)(Java Doc)
public int getIntegerProperty(String key, int def, List pflist) throws ProviderException(Code)(Java Doc)
public List getListProperty(String key) throws ProviderException(Code)(Java Doc)
public List getListProperty(String key, List def) throws ProviderException(Code)(Java Doc)
public Map getMapProperty(String key) throws ProviderException(Code)(Java Doc)
public Map getMapProperty(String key, List pflist) throws ProviderException(Code)(Java Doc)
public Map getMapProperty(String key, boolean localized) throws ProviderException(Code)(Java Doc)
public Map getMapProperty(String key, Map def) throws ProviderException(Code)(Java Doc)
public Map getMapProperty(String key, Map def, List pflist) throws ProviderException(Code)(Java Doc)
public Map getMapProperty(String key, Map def, boolean localized) throws ProviderException(Code)(Java Doc)
public String getStringAttribute(String name)(Code)(Java Doc)
public String getStringProperty(String key) throws ProviderException(Code)(Java Doc)
public String getStringProperty(String key, String def) throws ProviderException(Code)(Java Doc)
public String getStringProperty(String key, List pflist) throws ProviderException(Code)(Java Doc)
public String getStringProperty(String key, String def, List pflist) throws ProviderException(Code)(Java Doc)
public String getStringProperty(String key, boolean localized) throws ProviderException(Code)(Java Doc)
public String getStringProperty(String key, String def, boolean localized) throws ProviderException(Code)(Java Doc)
public StringBuffer getTemplate(String file) throws ProviderException(Code)(Java Doc)
public StringBuffer getTemplate(String file, Hashtable table) throws ProviderException(Code)(Java Doc)
public File getTemplatePath(String file) throws ProviderException(Code)(Java Doc)
public boolean isAllowed(String priv) throws ProviderException(Code)(Java Doc)
public boolean setBooleanProperty(String key, boolean val) throws ProviderException(Code)(Java Doc)
public void setClientProperty(String name, String val)(Code)(Java Doc)
public int setIntegerProperty(String key, int val) throws ProviderException(Code)(Java Doc)
public List setListProperty(String key, List val) throws ProviderException(Code)(Java Doc)
public Map setMapProperty(String key, Map val) throws ProviderException(Code)(Java Doc)
public void setStringAttribute(String name, String val)(Code)(Java Doc)
public String setStringProperty(String key, String val) throws ProviderException(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.