|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||

public interface IHttpServer
A HttpServer definition.
The http server accepts incoming connections and forwards the request to
the assigned IHttpRequestHandler. Example:
// defining a request handler
class MyRequestHandler implements IHttpRequestHandler {
public void onRequest(IHttpExchange exchange) throws IOException {
IHttpRequest request = exchange.getRequest();
//...
exchange.send(new HttpResponse(200, "text/plain", "it works"));
}
}
// creates a server
IServer server = new HttpServer(8080, new MyRequestHandler());
// setting some properties
server.setMaxTransactions(400);
server.setRequestTimeoutMillis(5 * 60 * 1000);
//...
// executing the server
server.run(); // (blocks forever)
// or server.start(); (blocks until the server has been started)
//...
| Field Summary |
|---|
| Fields inherited from interface org.xsocket.connection.IServer |
|---|
DEFAULT_CONNECTION_TIMEOUT_SEC, DEFAULT_IDLE_TIMEOUT_SEC, DEFAULT_READ_TRANSFER_PREALLOCATION_MIN_SIZE, DEFAULT_READ_TRANSFER_PREALLOCATION_SIZE, DEFAULT_READ_TRANSFER_USE_DIRECT, SO_RCVBUF, SO_REUSEADDR |
| Method Summary | |
|---|---|
int |
getAutoCompressThresholdBytes()
gets the autocompress threshold of responses |
long |
getBodyDataReceiveTimeoutMillis()
get the body data receive timeout |
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 seconds |
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 (4xx or 5xx) will be sent |
boolean |
isUsingCookies()
returns true, if cookies is used for session state management |
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 (4xx or 5xx) 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 timeoutMillis)
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 interface org.xsocket.connection.IServer |
|---|
addListener, getAutoflush, getConnectionTimeoutMillis, getFlushmode, getHandler, getIdleTimeoutMillis, getLocalAddress, getLocalPort, getOption, getOptions, getStartUpLogMessage, getWorkerpool, isOpen, removeListener, setAutoflush, setConnectionTimeoutMillis, setFlushmode, setIdleTimeoutMillis, setStartUpLogMessage, setWorkerpool, setWriteTransferRate, start |
| Methods inherited from interface java.lang.Runnable |
|---|
run |
| Methods inherited from interface java.io.Closeable |
|---|
close |
| Method Detail |
|---|
IHttpRequestHandler getRequestHandler()
void setAutoUncompress(boolean isAutoUncompress)
isAutoUncompress - true, if the request will be uncompressed (if compressed)boolean isAutoUncompress()
void setCloseOnSendingError(boolean isCloseOnSendingError)
isCloseOnSendingError - if the connection will closed, if an error message is sentboolean isCloseOnSendingError()
void setUsingCookies(boolean useCookies)
useCookies - true, if cookies isused for session state managementboolean isUsingCookies()
void setAutoCompressThresholdBytes(int autocompressThresholdBytes)
autocompressThresholdBytes - the autocompress thresholdint getAutoCompressThresholdBytes()
void setBodyDataReceiveTimeoutMillis(long bodyDataReceiveTimeoutMillis)
bodyDataReceiveTimeoutSec - the timeoutlong getBodyDataReceiveTimeoutMillis()
void setSessionMaxInactiveIntervalSec(int sessionMaxInactiveIntervalSec)
sessionMaxInactiveIntervalSec - the session max inactive interval in secondsint getSessionMaxInactiveIntervalSec()
void setMaxTransactions(int maxTransactions)
maxTransactions - the max transactionsint getMaxTransactions()
void setRequestBodyDefaultEncoding(String defaultEncoding)
encoding - the defaultEncodingString getRequestBodyDefaultEncoding()
void setSessionManager(ISessionManager sessionManager)
sessionManager - the session managerISessionManager getSessionManager()
long getRequestTimeoutMillis()
void setRequestTimeoutMillis(long timeoutMillis)
timeoutMillis - the message receive timeout
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||