Class RequestCounter
java.lang.Object
org.deltava.beans.system.RequestCounter
- All Implemented Interfaces:
Serializable,ViewEntry
A bean to track Spider requests.
- Since:
- 11.6
- Version:
- 11.6
- Author:
- Luke
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionRequestCounter(String addr) Initializes the counter.Clones a request counter. -
Method Summary
Modifier and TypeMethodDescriptionvoidblock(int duration) Blocks this address for a specified period of time.booleanReturns whethre an IP address is contained within this counter's network block.Returns the remote address.Returns information about this remote address' net block.Returns the date/time of the newest request.Returns the date/time of the oldest request.intReturns the number of requests for this address.Returns the CSS class for this object if rendered in a view table.intIncrements the request counter.voidmerge(RequestCounter rc) Mereges the totals of two counters together.voidpurge(int maxTime) Purges all access times more than a certain period of time old.voidsetDegraded(boolean isDegrade) Updates whether this request counter is in degraded status.voidUpdates information about this remote address' net block.
-
Constructor Details
-
RequestCounter
-
RequestCounter
Clones a request counter.- Parameters:
rc- the RequestCounter
-
-
Method Details
-
increment
public int increment()Increments the request counter.- Returns:
- the number of requests
-
block
public void block(int duration) Blocks this address for a specified period of time.- Parameters:
duration- the duration in seconds
-
setDegraded
public void setDegraded(boolean isDegrade) Updates whether this request counter is in degraded status.- Parameters:
isDegrade- TRUE if degraded, otherwise FALSE
-
getAddress
-
getIPInfo
Returns information about this remote address' net block.- Returns:
- an IPBlock
-
getOldest
Returns the date/time of the oldest request.- Returns:
- the date/time of the request, or null if none
-
getNewest
Returns the date/time of the newest request.- Returns:
- the date/time of the request, or null if none
-
getRequests
public int getRequests()Returns the number of requests for this address.- Returns:
- the number of requests
-
merge
Mereges the totals of two counters together. If the second counter is blocked, the later block time will be propagated.- Parameters:
rc- a RequestCounter
-
setIPInfo
Updates information about this remote address' net block.- Parameters:
ip- an IPInfo bean
-
contains
Returns whethre an IP address is contained within this counter's network block.- Parameters:
addr- the remote address- Returns:
- TRUE if there is a network block and the address is contained within it, otherwise FALSE
-
purge
public void purge(int maxTime) Purges all access times more than a certain period of time old.- Parameters:
maxTime- the time interval in seconds
-
getRowClassName
Description copied from interface:ViewEntryReturns the CSS class for this object if rendered in a view table.- Specified by:
getRowClassNamein interfaceViewEntry- Returns:
- the CSS class name, or NULL if none
-