|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.hd.d.pg2k.webSvr.exhibit.ServletUtils
public final class ServletUtils
Servlet-related utility functions. This mainly consists of small support routines for servlets in this package.
| Field Summary | |
|---|---|
private static int |
DEFAULT_MAX_HOTLINK_REQ_PERCENT
Default maximum percent of all exhibit requests that may come from one external source without us blocking them. |
private static boolean |
DELAY_HOTLINKER_WITH_YIELD
If true, allow Thread.yield() to delay the response to a hotlinker. |
| Constructor Summary | |
|---|---|
private |
ServletUtils()
Prevent construction of an instance. |
| Method Summary | |
|---|---|
(package private) static boolean |
noteAndOrBlockHotlinker(javax.servlet.ServletContext context,
javax.servlet.http.HttpServletRequest request,
java.lang.String normalisedReferringHost,
SimpleVariablePipelineIF vars,
GenProps gp)
Check if an apparent hotlinked request for an (exhibit or thumbnail) should be blocked. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final int DEFAULT_MAX_HOTLINK_REQ_PERCENT
A value of a few percent should allow legitimate referrals from bona fide image search engines and low volumes of traffic from small sites that we don't object to, but should veto egregious heavy misuse of bandwidth.
At 20050205 a threshold of about 25% would just about let in all legitimate referrals from the highest-volume search engines (images.search.yahoo.com, images.google.com) and disallow most of the unwanted hotlinking from third-party sights. This should prove itself to be reasonably conservative, and is used if no explicit GenProps values is supplied.
As of 20100606 the value that had been in use for some time was 5%.
private static final boolean DELAY_HOTLINKER_WITH_YIELD
| Constructor Detail |
|---|
private ServletUtils()
| Method Detail |
|---|
static boolean noteAndOrBlockHotlinker(javax.servlet.ServletContext context,
javax.servlet.http.HttpServletRequest request,
java.lang.String normalisedReferringHost,
SimpleVariablePipelineIF vars,
GenProps gp)
Absent or unparsable referrer URLs are not blocked by this mechanism (as these may be spiders or users running with "Referer" turned off for security reasons). They are dealt with in other ways.
Only call this where the referring URL seems dubious.
Algorithm for blocking requests by referrer:
Only package visible since only needed by servlets in this package.
request - the incoming request; never nullnormalisedReferringHost - the normalised hotlinking host's name; never nullvars - the DataSource; never null
|
DHD Multimedia Gallery V1.57.21 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||