|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectrabbit.proxy.Connection
public class Connection
The base connection class for rabbit. This is the class that handle the http protocoll for proxies. For the technical overview of how connections and threads works see the file htdocs/technical_documentation/thread_handling_overview.txt
Constructor Summary | |
---|---|
Connection(ConnectionId id,
SocketChannel channel,
HttpProxy proxy)
Create a new Connection |
Method Summary | |
---|---|
void |
doError(int status,
String message)
Send an error (400 Bad Request) to the client. |
SocketChannel |
getChannel()
Get the SocketChannel to the client |
boolean |
getChunking()
Get the chunking option. |
ClientResourceHandler |
getClientResourceHandler()
Get the client resource handler, that is the handler of any content the client is submitting (POSTED data, file uploads etc.) |
String |
getContentLength()
|
Counter |
getCounter()
|
String |
getDebugInfo()
Get debug info for use in 500 error response |
String |
getExtraInfo()
Get the extra information associated with the current request. |
HttpGenerator |
getHttpGenerator()
Get the HttpGenerator that this connection uses when it needs to generate a custom respons header and resource. |
ConnectionId |
getId()
|
boolean |
getMayFilter()
Get the state of the request. |
boolean |
getMeta()
Get the state of this request. |
NioHandler |
getNioHandler()
|
String |
getPassword()
Get the name of the user that is currently authorized. |
HttpProxy |
getProxy()
|
String |
getRequestLine()
Get the request line of the request currently being handled |
String |
getRequestURI()
Get the current request uri. |
String |
getRequestVersion()
Get the http version that the client used. |
long |
getStarted()
Get the time the current request was started. |
String |
getStatus()
Get the current status of this request |
String |
getUserName()
Get the name of the user that is currently authorized. |
void |
logAndClose()
Log the current request and close/end this connection |
void |
logAndTryRestart()
Log the current request and start to listen for a new request if possible. |
protected boolean |
mustTunnel()
Check if we must tunnel a request. |
void |
readRequest()
Read a request. |
void |
sendAndClose(HttpHeader header)
Send a request and then close this connection. |
void |
setChunking(boolean b)
Set the chunking option. |
void |
setContentLength(String contentLength)
Set the content length of the response. |
void |
setExtraInfo(String info)
Set the extra info. |
void |
setFilteringNotAllowed()
Get the state of this request. |
void |
setKeepalive(boolean keepalive)
Set keepalive to a new value. |
void |
setMayCache(boolean cacheAllowed)
Specify if we may cache the response resource. |
void |
setMayUseCache(boolean useCache)
Specify if the current resource may be served from our cache. |
void |
setMeta()
Flag this request as a meta-request, that is a request that the proxy should to handle. |
void |
setMustRevalidate()
Tell this connection that the current request must be revalidated. |
void |
setPassword(String password)
Set the password of the currently authenticated user (for basic proxy auth) |
void |
setStatusCode(String statusCode)
Set the status code for the current request |
void |
setUserName(String userName)
Set the name of the currently authenticated user (for basic proxy auth) |
void |
webConnectionEstablished(rabbit.proxy.RequestHandler rh)
Fired when a web connection has been established. |
void |
webConnectionSetupFailed(rabbit.proxy.RequestHandler rh,
Exception cause)
Fired when setting up a web connection failed. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Connection(ConnectionId id, SocketChannel channel, HttpProxy proxy)
id
- the ConnectionId of this connection.channel
- the SocketChannel to the client.proxy
- the HttpProxy that this connection belongs to.Method Detail |
---|
public ConnectionId getId()
public void readRequest()
public void webConnectionSetupFailed(rabbit.proxy.RequestHandler rh, Exception cause)
rh
- the RequestHandlercause
- the Exception that signaled the problemprotected boolean mustTunnel()
public void webConnectionEstablished(rabbit.proxy.RequestHandler rh)
rh
- the RequestHandler for the current requestpublic void doError(int status, String message)
status
- the status code of the error.message
- the error message to tell the client.public SocketChannel getChannel()
public NioHandler getNioHandler()
public HttpProxy getProxy()
public Counter getCounter()
public void setKeepalive(boolean keepalive)
keepalive
- the new keepalive value.public String getUserName()
public void setUserName(String userName)
userName
- the name of the current userpublic String getPassword()
public void setPassword(String password)
password
- the password that was used for authenticationpublic String getRequestLine()
public String getRequestURI()
public String getDebugInfo()
public String getRequestVersion()
public String getStatus()
public String getContentLength()
public ClientResourceHandler getClientResourceHandler()
public String getExtraInfo()
public void setExtraInfo(String info)
info
- the new info.public long getStarted()
public void setChunking(boolean b)
b
- if true this connection should use chunking.public boolean getChunking()
public boolean getMeta()
public void setMeta()
public void setMayUseCache(boolean useCache)
useCache
- true if we may use the cache for serving this request,
false otherwise.public void setMayCache(boolean cacheAllowed)
cacheAllowed
- true if we may cache the response, false otherwise.public void setFilteringNotAllowed()
public boolean getMayFilter()
public void setMustRevalidate()
public void setContentLength(String contentLength)
contentLength
- the new content length.public void setStatusCode(String statusCode)
statusCode
- the new status codepublic void sendAndClose(HttpHeader header)
header
- the HttpHeader to send before closing down.public void logAndClose()
public void logAndTryRestart()
public HttpGenerator getHttpGenerator()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |