|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.fatwire.crawler.WebResource
public class WebResource
This class is used to represent a resource which is downloaded as part of crawl session. A resource can be a java script file, an HTML file, an image etc, which is part of the web site.
Constructor Summary | |
---|---|
WebResource(ResourceURL url)
Constructor for creating an object of WebResource. |
Method Summary | |
---|---|
void |
addURL(ResourceURL link)
Adds a URL as found on this resource. |
void |
addURLs(java.util.List<ResourceURL> links)
Adds a list of URL's as found in this WebResource. |
byte[] |
getBinaryData()
The method is used to get the binary data for a resource that is downloaded as part of the crawl session. |
java.lang.String |
getContentEncoding()
Get content encoding for the downloaded WebResource. |
java.lang.String |
getContentType()
Returns content type of the downloaded WebResource. |
long |
getDownloadTime()
Returns the time it took to download this resource in milliseconds. |
org.apache.http.Header[] |
getHeaders()
Used to get all the headers inside the HTTP response for a WebResource. |
long |
getResourceSize()
Used to get content size of the downloaded resource. |
int |
getStatusCode()
Get the status code for the response while accessing the WebResource. |
java.lang.String |
getText()
Used to return the HTTP body as a string if text conversion is possible. |
java.net.URI |
getURI()
Returns the URI for the downloaded resource. |
ResourceURL |
getURL()
Returns the URL which was used to download this resource. |
java.util.Set<ResourceURL> |
getURLs()
The method is used to return the list of the url's that are found inside the web resource. |
boolean |
load(org.apache.http.HttpResponse response)
Reads the HttpResponse and sets various HTTP parameters on this resource. |
void |
setContentEncoding(java.lang.String contentEncoding)
Setter for content encoding. |
void |
setContentType(java.lang.String value)
Setter for the contentType. |
void |
setDownloadTime(long elapsed)
Sets the time taken to download the WebResource in milliseconds. |
void |
setStatusCode(int statusCode)
Setter for the HTTP response status code. |
Constructor Detail |
---|
public WebResource(ResourceURL url)
ResourceURL
- Takes a ResourceUrl object as parameter.Method Detail |
---|
public java.lang.String getText()
java.io.UnsupportedEncodingException
public java.util.Set<ResourceURL> getURLs()
public ResourceURL getURL()
public java.net.URI getURI()
public byte[] getBinaryData()
public boolean load(org.apache.http.HttpResponse response)
response
- HttpResponse for the web resource.
java.lang.IllegalStateException
java.io.IOException
public void addURLs(java.util.List<ResourceURL> links)
links
- List of ResourceURLpublic void addURL(ResourceURL link)
link
- ResourceURLpublic org.apache.http.Header[] getHeaders()
public void setStatusCode(int statusCode)
statusCode
- Status code for response.public int getStatusCode()
public void setContentType(java.lang.String value)
value
- public java.lang.String getContentEncoding()
public void setContentEncoding(java.lang.String contentEncoding)
contentEncoding
- public java.lang.String getContentType()
public void setDownloadTime(long elapsed)
elapsed
- Time elapsed in downloading a WebResource.public long getDownloadTime()
public long getResourceSize()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |