raining.server
Class DefaultPriorityHandler

java.lang.Object
raining.server.DefaultPriorityHandler
- All Implemented Interfaces:
- PriorityHandler
- public class DefaultPriorityHandler
- extends java.lang.Object
- implements PriorityHandler
a default priority handler - handles priority of read and host (on
connect).
Connects:
Checks a debarred(deny) hosts list and returns -1.
Checks a allowed hosts list. if it exists then only these are
allowed, all else are debarred.
If not, it checks a deny list, all these are denied, all else are
allowed.
Checks a favored hosts list and returns 1.
For all others returns 0.
Needs to look into subnets also.
Needs to pick from a file.
Read:
Checks operations.
Returns 1 for GET and 0 for POST.
Returns -1 for others.
Checks resource.
returns -1 for some folders
returns 1 for some resources
returns 0 for all others.
Under heavy loads the one operation may take REJECT_PRIORITY
or some folders may get REJECT_PRIORITY
For us incoming requests can only be ASCII, not unicode, so we shuold
find a way to avoid Strings and deal with char arrays.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
P
static final java.lang.String P
- See Also:
- Constant Field Values
HIGH_PRIORITY
public static final int HIGH_PRIORITY
- See Also:
- Constant Field Values
NORMAL_PRIORITY
public static final int NORMAL_PRIORITY
- See Also:
- Constant Field Values
REJECT_PRIORITY
public static final int REJECT_PRIORITY
- See Also:
- Constant Field Values
favored
protected java.util.Map favored
denied
protected java.util.Map denied
allowed
protected java.util.Map allowed
DefaultPriorityHandler
public DefaultPriorityHandler()
- constructor. TODO loading.
read_priority
public int read_priority(raining.core.Request request)
- returns priority after read , based on operation
requested, or file requested, or speed of data sent in.
returns -1 if this should be closed.
- Specified by:
read_priority in interface PriorityHandler
host_priority
public int host_priority(java.nio.channels.SocketChannel sc)
- returns the priority of the incoming host.
returns -1 if the host could be a DOS attack or should be closed
for some other reason.
TODO based on access.deny and allow policy
- Specified by:
host_priority in interface PriorityHandler