Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

raining.server
Class DefaultPriorityHandler  view DefaultPriorityHandler download DefaultPriorityHandler.java

java.lang.Object
  extended byraining.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.


Field Summary
protected  java.util.Map allowed
           
protected  java.util.Map denied
           
protected  java.util.Map favored
           
static int HIGH_PRIORITY
           
static int NORMAL_PRIORITY
           
(package private) static java.lang.String P
           
static int REJECT_PRIORITY
           
 
Constructor Summary
DefaultPriorityHandler()
          constructor.
 
Method Summary
 int host_priority(java.nio.channels.SocketChannel sc)
          returns the priority of the incoming host.
 int read_priority(raining.core.Request request)
          returns priority after read , based on operation requested, or file requested, or speed of data sent in.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

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
Constructor Detail

DefaultPriorityHandler

public DefaultPriorityHandler()
constructor. TODO loading.

Method Detail

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