public class ApacheScrapingHttpClient extends AbstractScrapingHttpClient
Modifier and Type | Field and Description |
---|---|
static org.apache.log4j.Logger |
log
Used for logging.
|
GLOBAL_REQUESTS_THREAD_LOCK, session
REDIRECT_WITH_POST_ENTITY_STATUS_CODE
Constructor and Description |
---|
ApacheScrapingHttpClient(ScrapingSession session)
Creates the client
|
ApacheScrapingHttpClient(ScrapingSession session,
boolean followRedirects)
Creates the client
|
Modifier and Type | Method and Description |
---|---|
void |
clearCookies()
Clears all cookies from this client
|
void |
close() |
java.util.List<ScrapingCookie> |
getCookies()
Returns a list of all the cookies for the current client, for any domain
|
protected ScrapingResponse |
issueRequestInternal(ScrapingRequest request)
Issues the given request
|
void |
setCookie(ScrapingCookie cookie)
Sets the cookie
|
void |
updateSessionClientInfo()
Tells the client the session http info value has changed.
|
boolean |
usesHint(ScrapingHint hint)
Returns whether or not this client implementation uses the given hint.
|
convertScrapeableFileToRequest, getProxy, isRedirectStatusCode, issueRequest, logDebug, logDebug, logError, logError, logInfo, logInfo, logWarn, logWarn, scrapeFile, setProxyServer
public ApacheScrapingHttpClient(@Nullable ScrapingSession session) throws java.lang.Exception
session
- The session, used for logging and various settingsjava.lang.Exception
- On error creating the clientpublic ApacheScrapingHttpClient(@Nullable ScrapingSession session, boolean followRedirects) throws java.lang.Exception
session
- The session, used for logging and various settingsfollowRedirects
- Whether redirects should be followed or notjava.lang.Exception
- On error creating the clientpublic void updateSessionClientInfo()
ScrapingHttpClient
public void setCookie(@NotNull ScrapingCookie cookie)
cookie
- The cookie to set@NotNull protected ScrapingResponse issueRequestInternal(@NotNull ScrapingRequest request)
issueRequestInternal
in class AbstractScrapingHttpClient
request
- The request to be issuedpublic boolean usesHint(@NotNull ScrapingHint hint)
hint
- The hint to test@NotNull public java.util.List<ScrapingCookie> getCookies()
public void clearCookies()
public void close()