rabbit.filter
Class HTTPBaseFilter

java.lang.Object
  extended byrabbit.filter.HTTPBaseFilter

public class HTTPBaseFilter
extends java.lang.Object

This is a class that filter http headers to make them nice. This filter sets up username and password if supplied and also sets up keepalive.


Field Summary
static java.lang.String NOPROXY
           
 
Method Summary
static HTTPHeader doHTTPInFiltering(java.net.Socket socket, HTTPHeader header, Connection con)
          test if a socket/header combination is valid or return a new HTTPHeader.
static HTTPHeader doHTTPOutFiltering(java.net.Socket socket, HTTPHeader header, Connection con)
          test if a socket/header combination is valid or return a new HTTPHeader.
static java.util.Hashtable getUsers()
          Return the hash of users.
static boolean isPublic(java.net.URL url)
          Check if a given url is a public URL of the Proxy.
static boolean isValidUser(java.lang.String username, java.lang.String password)
          Check if a user/password combination is valid.
static java.util.Hashtable loadUsers(java.io.Reader r)
          Load the users from the given Reader.
static java.util.Hashtable loadUsers(java.io.Reader r, boolean use)
          Load the users from the given Reader.
static void saveUsers(java.io.Reader r)
          Saves the users from the given Reader.
static void setup(java.util.Properties properties)
          Setup this class with the given properties.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NOPROXY

public static final java.lang.String NOPROXY
See Also:
Constant Field Values
Method Detail

doHTTPInFiltering

public static HTTPHeader doHTTPInFiltering(java.net.Socket socket,
                                           HTTPHeader header,
                                           Connection con)
test if a socket/header combination is valid or return a new HTTPHeader.

Parameters:
socket - the Socket that made the request.
header - the actual request made.
con - the Connection handling the request.
Returns:
null if everything is fine or a HTTPHeader describing the error (like a 403).

doHTTPOutFiltering

public static HTTPHeader doHTTPOutFiltering(java.net.Socket socket,
                                            HTTPHeader header,
                                            Connection con)
test if a socket/header combination is valid or return a new HTTPHeader.

Parameters:
socket - the Socket that made the request.
header - the actual request made.
con - the Connection handling the request.
Returns:
null if everything is fine or a HTTPHeader describing the error (like a 403).

setup

public static void setup(java.util.Properties properties)
Setup this class with the given properties.

Parameters:
properties - the new configuration of this class.

loadUsers

public static java.util.Hashtable loadUsers(java.io.Reader r)
                                     throws java.io.IOException
Load the users from the given Reader.

Parameters:
r - the Reader with the users.
Throws:
java.io.IOException

loadUsers

public static java.util.Hashtable loadUsers(java.io.Reader r,
                                            boolean use)
                                     throws java.io.IOException
Load the users from the given Reader.

Parameters:
r - the Reader with the users.
Throws:
java.io.IOException

saveUsers

public static void saveUsers(java.io.Reader r)
                      throws java.io.IOException
Saves the users from the given Reader.

Parameters:
r - the Reader with the users.
Throws:
java.io.IOException

getUsers

public static java.util.Hashtable getUsers()
Return the hash of users.


isValidUser

public static boolean isValidUser(java.lang.String username,
                                  java.lang.String password)
Check if a user/password combination is valid.

Parameters:
username - the username.
password - the decrypted password.
Returns:
true if both username and password match a valid user.

isPublic

public static boolean isPublic(java.net.URL url)
Check if a given url is a public URL of the Proxy.

Parameters:
url - the URL to check.
Returns:
true if this url has public access, false otherwise.