org.archive.crawler.datamodel.credential
Class HtmlFormCredential

java.lang.Object
  extended by javax.management.Attribute
      extended by org.archive.crawler.settings.Type
          extended by org.archive.crawler.settings.ComplexType
              extended by org.archive.crawler.settings.ModuleType
                  extended by org.archive.crawler.datamodel.credential.Credential
                      extended by org.archive.crawler.datamodel.credential.HtmlFormCredential
All Implemented Interfaces:
java.io.Serializable, javax.management.DynamicMBean

public class HtmlFormCredential
extends Credential

Credential that holds all needed to do a GET/POST to a HTML form.

Version:
$Revision: 5913 $, $Date: 2008-07-28 22:34:52 +0000 (Mon, 28 Jul 2008) $
Author:
stack
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.archive.crawler.settings.ComplexType
ComplexType.MBeanAttributeInfoIterator
 
Field Summary
 
Fields inherited from class org.archive.crawler.settings.ComplexType
definition, definitionMap
 
Constructor Summary
HtmlFormCredential(java.lang.String name)
          Constructor.
 
Method Summary
 java.util.Map<java.lang.String,java.lang.Object> getFormItems(CrawlURI context)
           
 java.lang.String getHttpMethod(CrawlURI context)
           
 java.lang.String getKey(CrawlURI curi)
           
 java.lang.String getLoginUri(CrawlURI context)
           
 java.lang.String getPrerequisite(CrawlURI curi)
          Return the authentication URI, either absolute or relative, that serves as prerequisite the passed curi.
 boolean hasPrerequisite(CrawlURI curi)
           
 boolean isEveryTime()
           
 boolean isPost(CrawlURI curi)
           
 boolean isPrerequisite(CrawlURI curi)
           
 boolean populate(CrawlURI curi, org.apache.commons.httpclient.HttpClient http, org.apache.commons.httpclient.HttpMethod method, java.lang.String payload)
           
 
Methods inherited from class org.archive.crawler.datamodel.credential.Credential
attach, attach, detach, detachAll, getCredentialDomain, rootUriMatch, setCredentialDomain
 
Methods inherited from class org.archive.crawler.settings.ModuleType
addElement, listUsedFiles
 
Methods inherited from class org.archive.crawler.settings.ComplexType
addElementToDefinition, checkValue, earlyInitialize, getAbsoluteName, getAttribute, getAttribute, getAttribute, getAttributeInfo, getAttributeInfo, getAttributeInfoIterator, getAttributes, getDataContainerRecursive, getDataContainerRecursive, getDefaultValue, getDescription, getElementFromDefinition, getLegalValues, getLocalAttribute, getMBeanInfo, getMBeanInfo, getParent, getPreservedFields, getSettingsHandler, getUncheckedAttribute, getValue, globalSettings, invoke, isInitialized, isOverridden, iterator, removeElementFromDefinition, setAsOrder, setAttribute, setAttribute, setAttributes, setDescription, setPreservedFields, toString, unsetAttribute
 
Methods inherited from class org.archive.crawler.settings.Type
addConstraint, equals, getConstraints, getLegalValueType, isExpertSetting, isOverrideable, isTransient, setExpertSetting, setLegalValueType, setOverrideable, setTransient
 
Methods inherited from class javax.management.Attribute
getName, hashCode
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HtmlFormCredential

public HtmlFormCredential(java.lang.String name)
Constructor. A constructor that takes name of the credential is required by settings framework.

Parameters:
name - Name of this credential.
Method Detail

getLoginUri

public java.lang.String getLoginUri(CrawlURI context)
                             throws javax.management.AttributeNotFoundException
Parameters:
context - CrawlURI context to use.
Returns:
login-uri.
Throws:
javax.management.AttributeNotFoundException

getHttpMethod

public java.lang.String getHttpMethod(CrawlURI context)
                               throws javax.management.AttributeNotFoundException
Parameters:
context - CrawlURI context to use.
Returns:
login-uri.
Throws:
javax.management.AttributeNotFoundException

getFormItems

public java.util.Map<java.lang.String,java.lang.Object> getFormItems(CrawlURI context)
                                                              throws javax.management.AttributeNotFoundException
Parameters:
context - CrawlURI context to use.
Returns:
Form inputs as convenient map. Returns null if no form items.
Throws:
javax.management.AttributeNotFoundException

isPrerequisite

public boolean isPrerequisite(CrawlURI curi)
Specified by:
isPrerequisite in class Credential
Parameters:
curi - CrawlURI to look at.
Returns:
True if this credential IS a prerequisite for passed CrawlURI.

hasPrerequisite

public boolean hasPrerequisite(CrawlURI curi)
Specified by:
hasPrerequisite in class Credential
Parameters:
curi - CrawlURI to look at.
Returns:
True if this credential HAS a prerequisite for passed CrawlURI.

getPrerequisite

public java.lang.String getPrerequisite(CrawlURI curi)
Description copied from class: Credential
Return the authentication URI, either absolute or relative, that serves as prerequisite the passed curi.

Specified by:
getPrerequisite in class Credential
Parameters:
curi - CrawlURI to look at.
Returns:
Prerequisite URI for the passed curi.

getKey

public java.lang.String getKey(CrawlURI curi)
                        throws javax.management.AttributeNotFoundException
Specified by:
getKey in class Credential
Parameters:
curi - Context to use when searching for credential domain.
Returns:
Key that is unique to this credential type.
Throws:
javax.management.AttributeNotFoundException

isEveryTime

public boolean isEveryTime()
Specified by:
isEveryTime in class Credential
Returns:
True if this credential is of the type that needs to be offered on each visit to the server (e.g. Rfc2617 is such a type).

populate

public boolean populate(CrawlURI curi,
                        org.apache.commons.httpclient.HttpClient http,
                        org.apache.commons.httpclient.HttpMethod method,
                        java.lang.String payload)
Specified by:
populate in class Credential
Parameters:
curi - CrawlURI to as for context.
http - Instance of httpclient.
method - Method to populate.
payload - Avatar payload to use populating the method.
Returns:
True if added a credentials.

isPost

public boolean isPost(CrawlURI curi)
Specified by:
isPost in class Credential
Parameters:
curi - CrawlURI to look at.
Returns:
True if this credential is to be posted. Return false if the credential is to be GET'd or if POST'd or GET'd are not pretinent to this credential type.


Copyright © 2003-2011 Internet Archive. All Rights Reserved.