public class SpiderGitParser extends SpiderParser
log
Constructor and Description |
---|
SpiderGitParser(SpiderParam params)
Instantiates a new spider Git Index parser.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canParseResource(HttpMessage message,
String path,
boolean wasAlreadyParsed)
Checks whether the parser should be called to parse the given HttpMessage.
|
boolean |
parseResource(HttpMessage message,
net.htmlparser.jericho.Source source,
int depth)
Parses the resource.
|
addSpiderParserListener, getLogger, notifyListenersPostResourceFound, notifyListenersResourceFound, notifyListenersResourceFound, processURL, removeSpiderParserListener
public SpiderGitParser(SpiderParam params)
params
- the paramspublic boolean parseResource(HttpMessage message, net.htmlparser.jericho.Source source, int depth)
SpiderParser
When a link is encountered, implementations can use SpiderParser.processURL(HttpMessage, int,
String, String)
and SpiderParser.notifyListenersResourceFound(SpiderResourceFound)
to announce
the found URIs.
The return value specifies whether the resource should be considered 'completely processed'/consumed and should be treated accordingly by subsequent parsers. For example, any parsers which are meant to be 'fall-back' parsers should skip messages already processed by other parsers.
parseResource
in class SpiderParser
message
- the full http message containing the request and the responsesource
- a Jericho source with the Response Body from the HTTP message. This parameter
can be null
, in which case the parser implementation should ignore it.depth
- the depth of this resourcepublic boolean canParseResource(HttpMessage message, String path, boolean wasAlreadyParsed)
SpiderParser
Based on the specifics of the HttpMessage and whether this message was already processed
by another Parser, this method should decide whether the SpiderParser.parseResource(HttpMessage,
Source, int)
should be invoked.
The wasAlreadyConsumed
could be used by parsers which represent a 'fall-back'
parser to check whether any other parser has processed the message before.
canParseResource
in class SpiderParser
message
- the full http message containing the request and the responsepath
- the resource path, provided for conveniencewasAlreadyParsed
- if the resource was already parsed by another SpiderParserSpiderParser.parseResource(HttpMessage, Source, int)
should be invoked.