|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.xlightweb.server.HttpProtocolAdapter
public final class HttpProtocolAdapter
The http protocol adapter. The protocol adapter implements the IConnectHandler
interface, and
"maps" each incoming connection into a HttpServerConnection
.
HttpProtcol adapter will be required, if the HttpServer
can not be used. See example:
// establishing a http server based on a mutliplexed tcp connection // for multiplexed connections see http://xsocket.sourceforge.net/multiplexed/tutorial/V2/TutorialMultiplexed.htm IRequestHandler hdl = new MyRequestHandler(); IConnectHandler httpAdapter = new HttpProtocolAdapter(hdl); IServer mutliplexedHttpServer = new Server(8080, new MultiplexedProtocolAdapter(httpAdapter))); mutliplexedHttpServer.start(); ...
Nested Class Summary | |
---|---|
static interface |
HttpProtocolAdapter.SessionManagerInfoMBean
|
Field Summary |
---|
Fields inherited from interface org.xsocket.connection.IHandler |
---|
DEFAULT_EXECUTION_MODE |
Constructor Summary | |
---|---|
HttpProtocolAdapter(IHttpRequestHandler requestHandler)
constructor |
Method Summary | |
---|---|
void |
addConnectionHandler(IHttpConnectionHandler connectionHandler)
adds a connection handler |
int |
getAutoCompressThresholdBytes()
gets the autocompress threshold of responses |
long |
getBodyDataReceiveTimeoutMillis()
get the body data receive timeout |
String |
getImplementationVersion()
returns the implementation version string |
int |
getMaxTransactions()
get the max transactions per connection. |
String |
getRequestBodyDefaultEncoding()
get the request body default encoding. |
IHttpRequestHandler |
getRequestHandler()
returns the request handler |
long |
getRequestTimeoutMillis()
gets the message receive timeout |
ISessionManager |
getSessionManager()
returns the session manager |
int |
getSessionMaxInactiveIntervalSec()
gets the session max inactive interval in sconds |
boolean |
isAutoUncompress()
return true, if the request will be uncompressed (if compressed) |
boolean |
isCloseOnSendingError()
returns if the server-side connection will closed, if an error message will be sent |
boolean |
isUsingCookies()
returns true, if cookies is used for session state management |
boolean |
onConnect(INonBlockingConnection connection)
|
void |
onDestroy()
|
void |
onInit()
|
void |
postDeregister()
|
void |
postRegister(Boolean registrationDone)
|
void |
preDeregister()
|
ObjectName |
preRegister(MBeanServer mbeanServer,
ObjectName name)
|
void |
setAutoCompressThresholdBytes(int autocompressThresholdBytes)
sets the autocompress threshold of responses |
void |
setAutoUncompress(boolean isAutoUncompress)
set if the request will be uncompressed (if compressed) |
void |
setBodyDataReceiveTimeoutMillis(long bodyDataReceiveTimeoutMillis)
set the body data receive timeout |
void |
setCloseOnSendingError(boolean isCloseOnSendingError)
set is if the server-side connection will closed, if an error message is sent |
void |
setMaxTransactions(int maxTransactions)
set the max transactions per connection. |
void |
setRequestBodyDefaultEncoding(String defaultEncoding)
set the request body default encoding. |
void |
setRequestTimeoutMillis(long requesttimeout)
sets the message receive timeout |
void |
setSessionManager(ISessionManager sessionManager)
sets the session manager |
void |
setSessionMaxInactiveIntervalSec(int sessionMaxInactiveIntervalSec)
sets the session max inactive interval in seconds |
void |
setUsingCookies(boolean useCookies)
sets if cookies is used for session state management |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public HttpProtocolAdapter(IHttpRequestHandler requestHandler)
requestHandler
- the requestHandlerconnectionHandler
- the connectionHandler or null
requestTimeoutHandler
- the request timeout handler or null
Method Detail |
---|
public IHttpRequestHandler getRequestHandler()
public void setSessionManager(ISessionManager sessionManager)
sessionManager
- the session managerpublic void setUsingCookies(boolean useCookies)
useCookies
- true, if cookies isused for session state managementpublic boolean isUsingCookies()
public ISessionManager getSessionManager()
public void setRequestBodyDefaultEncoding(String defaultEncoding)
encoding
- the defaultEncodingpublic String getRequestBodyDefaultEncoding()
public ObjectName preRegister(MBeanServer mbeanServer, ObjectName name) throws Exception
preRegister
in interface MBeanRegistration
Exception
public void postRegister(Boolean registrationDone)
postRegister
in interface MBeanRegistration
public void preDeregister() throws Exception
preDeregister
in interface MBeanRegistration
Exception
public void postDeregister()
postDeregister
in interface MBeanRegistration
public void setRequestTimeoutMillis(long requesttimeout)
requesttimeout
- the message receive timeoutpublic void setAutoCompressThresholdBytes(int autocompressThresholdBytes)
autocompressThresholdBytes
- the autocompress thresholdpublic int getAutoCompressThresholdBytes()
public void setAutoUncompress(boolean isAutoUncompress)
isAutoUncompress
- true, if the request will be uncompressed (if compressed)public boolean isAutoUncompress()
public long getRequestTimeoutMillis()
public void setBodyDataReceiveTimeoutMillis(long bodyDataReceiveTimeoutMillis)
bodyDataReceiveTimeoutSec
- the timeoutpublic long getBodyDataReceiveTimeoutMillis()
public void setCloseOnSendingError(boolean isCloseOnSendingError)
isCloseOnSendingError
- if the connection will closed, if an error message is sentpublic boolean isCloseOnSendingError()
public void setMaxTransactions(int maxTransactions)
maxTransactions
- the max transactionspublic int getMaxTransactions()
public void setSessionMaxInactiveIntervalSec(int sessionMaxInactiveIntervalSec)
sessionMaxInactiveIntervalSec
- the session max inactive interval in secondspublic int getSessionMaxInactiveIntervalSec()
public void addConnectionHandler(IHttpConnectionHandler connectionHandler)
connectionHandler
- the connection handler to addpublic String getImplementationVersion()
public void onInit()
onInit
in interface ILifeCycle
public void onDestroy() throws IOException
onDestroy
in interface ILifeCycle
IOException
public boolean onConnect(INonBlockingConnection connection) throws IOException
onConnect
in interface IConnectHandler
IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |