|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectrabbit.proxy.Proxy
public class Proxy
This is the central dispatcher for RabbIT. Basically it sits in a loop accepting connection and for each connection creating a handler for it. Also handles logging so it goes out nicely formatted (and synchronized).
Field Summary | |
---|---|
protected static java.lang.String |
CONFIG
The standard configuration file |
protected DNSHandler |
dnsHandler
The dns handler |
protected boolean |
proxySSL
Are we allowed to proxy ssl? |
protected java.util.List<java.lang.Integer> |
sslports
The List of acceptable ssl-ports. |
static java.lang.String |
VERSION
Current version |
Fields inherited from interface rabbit.util.Logger |
---|
ALL, DEBUG, ERROR, FATAL, INFO, MSG, WARN |
Constructor Summary | |
---|---|
Proxy()
Constructor, |
Method Summary | |
---|---|
protected void |
closeSocket()
Closes the serversocket and makes the proxy stop listening for connections. |
java.util.List<IPAccessFilter> |
getAccessFilters()
|
NCache |
getCache()
Get the cache the proxy are using. |
java.util.Map<java.lang.String,HandlerFactory> |
getCacheHandlers()
|
Config |
getConfig()
|
ConnectionHandler |
getConnectionHandler()
Get the connection handler. |
int |
getConnectPort(int port)
Get the port to connect to. |
Counter |
getCounter()
Get the Log-handle |
java.util.List |
getCurrentConections()
returns the current connections. |
int |
getErrorLevel(java.lang.String errorlevel)
Get the actual error level from the given String. |
java.lang.String |
getErrorLevelString(int errorlevel)
Get the String description of the given error level |
java.util.Map<java.lang.String,HandlerFactory> |
getHandlers()
|
java.net.InetAddress |
getHost()
Get the local host. |
java.util.List<HTTPFilter> |
getHTTPInFilters()
|
java.util.List<HTTPFilter> |
getHTTPOutFilters()
|
java.net.InetAddress |
getInetAddress(java.net.URL url)
Get the InetAddress to connect to. |
NLSOHandler |
getNLSOHandler()
|
long |
getOffset()
Get the offset in milis from GMT NOTE! the offset is only calculated at startup. |
int |
getPort()
Get the port this proxy is using. |
java.lang.String |
getProxyAuthString()
Get the authenticationstring to use for proxy. |
java.lang.String |
getServerIdentity()
|
java.util.Date |
getStartDate()
return the time when the proxy was started. |
ThreadPool.Usage |
getThreadPoolUsage()
|
java.util.TimeZone |
getTimeZone()
Get the time zone the proxy is running in. |
WebConnection |
getWebConnection(HTTPHeader header)
Get a WebConnection. |
boolean |
isProxyConnected()
are we connected to another proxy? |
boolean |
isSelf(java.lang.String uhost,
int urlport)
Try hard to check if the given address matches the proxy. |
void |
kill()
shutdown |
protected void |
loadClasses()
Make sure all filters and handlers are available |
protected java.util.Map<java.lang.String,HandlerFactory> |
loadHandlers(java.lang.String section)
load a set of handlers. |
void |
logConnection(Connection con)
log a connection handled. |
void |
logError(int type,
java.lang.String error)
log errors and other important stuff. |
void |
logError(java.lang.String error)
log errors and other important stuff. |
static void |
main(java.lang.String[] args)
Start a proxy. |
void |
markForPipelining(WebConnection wc)
Mark a WebConnection for pipelining. |
protected void |
openSocket()
Open a socket on the specified port also make the proxy continue accepting connections. |
void |
reConfigure(Config config)
Reconfigure the proxy during runtime. |
void |
releaseWebConnection(WebConnection wc)
Release a WebConnection so that it may be reused if possible. |
void |
removeConnection(Connection con)
Remove a connection (it has received full treatment) |
protected void |
returnSocket(java.nio.channels.SocketChannel sc)
|
void |
rotateLogs()
Rotate the logs. |
void |
run()
while we can, accept new sockets, creating a handler for each and also save connections for statistics. |
void |
saveConfig()
save the config back to file |
void |
setProxy(java.lang.String proxyHost)
Set the proxy to use. |
void |
setProxyPort(int newProxyPort)
Set the proxy port to use. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String VERSION
protected static final java.lang.String CONFIG
protected boolean proxySSL
protected java.util.List<java.lang.Integer> sslports
protected DNSHandler dnsHandler
Constructor Detail |
---|
public Proxy()
Method Detail |
---|
public static void main(java.lang.String[] args)
args
- the command-line flags given.public java.util.TimeZone getTimeZone()
public long getOffset()
public ThreadPool.Usage getThreadPoolUsage()
public ConnectionHandler getConnectionHandler()
public WebConnection getWebConnection(HTTPHeader header) throws java.io.IOException
java.io.IOException
public void releaseWebConnection(WebConnection wc)
wc
- the WebConnection to release.public void markForPipelining(WebConnection wc)
wc
- the WebConnection to mark.public void run()
run
in interface java.lang.Runnable
protected void returnSocket(java.nio.channels.SocketChannel sc) throws java.io.IOException
java.io.IOException
protected void openSocket()
protected void closeSocket()
public void reConfigure(Config config)
config
- the new config.public void rotateLogs()
public void setProxy(java.lang.String proxyHost) throws java.net.UnknownHostException
java.net.UnknownHostException
public void setProxyPort(int newProxyPort)
public void saveConfig()
public int getErrorLevel(java.lang.String errorlevel)
errorlevel
- the String to translate.
public java.lang.String getErrorLevelString(int errorlevel)
errorlevel
- the int to translate to a String.
public void logError(java.lang.String error)
logError
in interface Logger
error
- the thing that happend.public void logError(int type, java.lang.String error)
logError
in interface Logger
type
- the type of the error.error
- the thing that happend.public Config getConfig()
public NCache getCache()
public Counter getCounter()
public int getPort()
public java.net.InetAddress getHost()
public boolean isSelf(java.lang.String uhost, int urlport)
public boolean isProxyConnected()
isProxyConnected
in interface Resolver
public java.net.InetAddress getInetAddress(java.net.URL url) throws java.net.UnknownHostException
getInetAddress
in interface Resolver
java.net.UnknownHostException
public int getConnectPort(int port)
getConnectPort
in interface Resolver
port
- the port we want to connect to.
public java.lang.String getProxyAuthString()
getProxyAuthString
in interface Resolver
public java.util.List getCurrentConections()
public void removeConnection(Connection con)
con
- the connection that is closing down.public java.util.Date getStartDate()
public java.lang.String getServerIdentity()
public java.util.Map<java.lang.String,HandlerFactory> getHandlers()
public java.util.Map<java.lang.String,HandlerFactory> getCacheHandlers()
public java.util.List<IPAccessFilter> getAccessFilters()
public java.util.List<HTTPFilter> getHTTPInFilters()
public java.util.List<HTTPFilter> getHTTPOutFilters()
public NLSOHandler getNLSOHandler()
protected java.util.Map<java.lang.String,HandlerFactory> loadHandlers(java.lang.String section)
section
- the section in the config file.
protected void loadClasses()
public void logConnection(Connection con)
con
- the Connection that handled a requestpublic void kill()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |