org.niocchi.core
Class Query

java.lang.Object
  extended by org.niocchi.core.Query

public class Query
extends java.lang.Object

An object that encapsulate an URL to be crawled and the returned crawl status. The default maximum redirections = 5.


Nested Class Summary
static class Query.Method
           
 
Constructor Summary
Query()
           
Query(Query query_)
           
Query(java.lang.String str_)
           
Query(java.net.URL url_)
           
 
Method Summary
 java.lang.String getHost()
          Returns the host part of the associated URL (returned by getURL())
 int getHTTPStatus()
          Returns the HTTP status or _UNKNOWN_HTTP_STATUS if no available status.
 java.net.InetSocketAddress getInetSocketAddress()
          Returns the InetSocketAddress or null if the query is not resolved.
static int getMaxRedirections()
           
 Query.Method getMethod()
          Returns the method.
 java.net.URL getOriginalURL()
          Returns the original URL (passed to the constructor).
 java.lang.String getPostData()
          Returns the data to send through POST.
 int getRedirected()
           
 Resource getResource()
          Returns the resource associated to this query.
 QueryStatus getStatus()
          Returns the query status.
 java.net.URL getURL()
          Returns the last URL to be crawled (the original URL if no redirection was followed).
 boolean hasReachedMaxRedirections()
           
 void incRedirected()
           
 void readFields(java.io.DataInput in)
           
static void setMaxRedirections(int max_)
           
 void setMethod(Query.Method _method)
          Set the method (GET or POST).
 void setPostData(java.lang.String _bodyData)
          Set the data to send through POST.
 void setStatus(QueryStatus status)
          Sets the status of this resource.
 void write(java.io.DataOutput out)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Query

public Query()

Query

public Query(java.lang.String str_)
      throws java.net.MalformedURLException
Throws:
java.net.MalformedURLException

Query

public Query(java.net.URL url_)

Query

public Query(Query query_)
Method Detail

getHTTPStatus

public int getHTTPStatus()
Returns the HTTP status or _UNKNOWN_HTTP_STATUS if no available status.

Returns:
the HTTP status.

getStatus

public QueryStatus getStatus()
Returns the query status. A newly created Query gets the status UNRESOLVED.

Returns:
the status.

setStatus

public void setStatus(QueryStatus status)
Sets the status of this resource.


getMaxRedirections

public static int getMaxRedirections()

setMaxRedirections

public static void setMaxRedirections(int max_)

getInetSocketAddress

public java.net.InetSocketAddress getInetSocketAddress()
Returns the InetSocketAddress or null if the query is not resolved.

Returns:
the InetSocketAddress or null if the query is not resolved.

getHost

public java.lang.String getHost()
Returns the host part of the associated URL (returned by getURL())

Returns:
the host

getURL

public java.net.URL getURL()
Returns the last URL to be crawled (the original URL if no redirection was followed).

Returns:
the URL

getOriginalURL

public java.net.URL getOriginalURL()
Returns the original URL (passed to the constructor).

Returns:
the URL

getResource

public Resource getResource()
Returns the resource associated to this query.

Returns:
the resource

setMethod

public void setMethod(Query.Method _method)
Set the method (GET or POST). Default is GET.

Parameters:
_method - The method.

getMethod

public Query.Method getMethod()
Returns the method.

Returns:
_method the method

setPostData

public void setPostData(java.lang.String _bodyData)
Set the data to send through POST.

Parameters:
_bodyData - The data.

getPostData

public java.lang.String getPostData()
Returns the data to send through POST.

Returns:
_bodyData the data

getRedirected

public int getRedirected()

incRedirected

public void incRedirected()

hasReachedMaxRedirections

public boolean hasReachedMaxRedirections()

write

public void write(java.io.DataOutput out)
           throws java.io.IOException
Throws:
java.io.IOException

readFields

public void readFields(java.io.DataInput in)
                throws java.io.IOException
Throws:
java.io.IOException