public interface IServer
IFrontController as
a dependency and call handle(...) on it when
a new request is made.| Modifier and Type | Method and Description |
|---|---|
void |
addCookies(Object exchange,
Map<String,ICookie> cookies)
Adds cookies.
|
void |
addHttpAuthentication(String realmName,
String username,
String password)
Adds a user to an HTTP protected realm.
|
void |
addStaticResourceToServe(IStaticResource<?> staticResource)
Adds a static resource to serve directly by the server.
|
void |
createHttpAuthenticationRealm(String pathPrefix,
String realmName)
Creates HTTP authentication protection (realm) for the
specified path prefix.
|
void |
end(Object exchange)
Ends the exchange.
|
void |
flushBytes(Object exchange,
byte[] bytes,
boolean end)
Flushes some bytes to the response.
|
boolean |
forceRequestSizeValidation(Object exchange)
Is the request size valid?
|
ContentTypeDefaults |
getContentTypeBestMatch(Object exchange)
Gets the best
Content-Type to use for the current request. |
Map<String,ICookie> |
getCookies(Object exchange)
Gets the current cookies.
|
Map<String,List<String>> |
getFormDatas(Object exchange)
The form datas, if any.
|
String |
getFullUrl(Object exchange)
The full encoded URL of the original request, including the queryString.
|
Map<String,String> |
getHttpAuthenticationRealms()
Returns the existing HTTP authentication realms, the
key being the realm's name and the value being the
prefix path associated to this realm.
|
HttpMethod |
getHttpMethod(Object exchange)
Gets the HTTP method associated with the request.
|
Map<String,List<String>> |
getQueryStringParams(Object exchange)
Gets the queryString parameters.
|
InputStream |
getRawInputStream(Object exchange)
The raw InputStream of the current request.
|
Map<String,List<String>> |
getRequestHeaders(Object exchange)
The headers from the request.
|
String |
getRequestScheme(Object exchange)
Gets the request scheme, "http" for example.
|
Map<String,List<String>> |
getResponseHeaders(Object exchange)
Gets the response headers.
|
IStaticResource<?> |
getStaticResourceServed(String urlPath)
Gets a static resource served directly by the server, using its path.
|
Set<IStaticResource<?>> |
getStaticResourcesServed()
Gets all static resource served directly by the server.
|
Map<String,List<File>> |
getUploadedFiles(Object exchange)
The uploaded files, if any.
|
IWebsocketEndpointManager |
getWebsocketEndpointManager(String endpointId)
Returns the manager for a Websockets endpoint.
|
List<IWebsocketEndpointManager> |
getWebsocketEndpointManagers()
Returns the managers of the existing Websockets endpoints.
|
boolean |
isResponseClosed(Object exchange)
Is the response closed?
|
boolean |
isResponseHeadersSent(Object exchange)
Are the response headers sent?
|
void |
removeAllStaticResourcesServed()
Removes all static resources served directly by the server.
|
void |
removeHttpAuthentication(String username)
Removes a user from all HTTP protected realms.
|
void |
removeHttpAuthentication(String username,
String realmName)
Removes a user to an HTTP protected realm.
|
void |
removeResponseHeader(Object exchange,
String name)
Removes a response header.
|
void |
removeStaticResourcesServed(StaticResourceType staticResourceType,
String urlPath)
Removes a static resource served directly by the server.
|
void |
setResponseHeader(Object exchange,
String name,
List<String> values)
Sets a response header.
|
void |
setResponseHeaders(Object exchange,
Map<String,List<String>> headers)
Sets the response headers.
|
void |
setResponseStatusCode(Object exchange,
int statusCode)
Sets the response status code.
|
void |
start()
Starts the server.
|
void |
stop()
Stops the server
|
void |
websocketCloseEndpoint(String endpointId)
Closes a Websocket endpoint.
|
void |
websocketCloseEndpoint(String endpointId,
int closingCode,
String closingReason)
Closes the entire Websocket endpoint.
|
void |
websocketConnection(Object exchange,
String endpointId,
String peerId)
Transforms the request to a peer Websocket connection
on the endpoint 'endpointId'.
|
IWebsocketEndpointManager |
websocketCreateEndpoint(String endpointId,
IWebsocketEndpointHandler endpointHandler)
Creates a new Websocket endpoint.
|
void start()
void stop()
void addStaticResourceToServe(IStaticResource<?> staticResource)
void removeStaticResourcesServed(StaticResourceType staticResourceType, String urlPath)
void removeAllStaticResourcesServed()
IStaticResource<?> getStaticResourceServed(String urlPath)
Set<IStaticResource<?>> getStaticResourcesServed()
HttpMethod getHttpMethod(Object exchange)
String getFullUrl(Object exchange)
ContentTypeDefaults getContentTypeBestMatch(Object exchange)
Content-Type to use for the current request.void setResponseHeaders(Object exchange, Map<String,List<String>> headers)
void setResponseHeader(Object exchange, String name, List<String> values)
Map<String,List<String>> getResponseHeaders(Object exchange)
void removeResponseHeader(Object exchange, String name)
Map<String,List<String>> getQueryStringParams(Object exchange)
void setResponseStatusCode(Object exchange, int statusCode)
void flushBytes(Object exchange, byte[] bytes, boolean end)
end - if true, the exchange will be closed
and nothing more can be send.void end(Object exchange)
boolean isResponseClosed(Object exchange)
boolean isResponseHeadersSent(Object exchange)
String getRequestScheme(Object exchange)
InputStream getRawInputStream(Object exchange)
Map<String,List<File>> getUploadedFiles(Object exchange)
boolean forceRequestSizeValidation(Object exchange)
Map<String,List<String>> getRequestHeaders(Object exchange)
void createHttpAuthenticationRealm(String pathPrefix, String realmName)
realmName - The name of the realm. Must be unique on this server,
otherwise an exception is thrown. This allows the application to add
user to the realm using its name.Map<String,String> getHttpAuthenticationRealms()
The map is immutable.
void addHttpAuthentication(String realmName, String username, String password)
void removeHttpAuthentication(String username, String realmName)
void removeHttpAuthentication(String username)
IWebsocketEndpointManager websocketCreateEndpoint(String endpointId, IWebsocketEndpointHandler endpointHandler)
void websocketCloseEndpoint(String endpointId)
void websocketCloseEndpoint(String endpointId, int closingCode, String closingReason)
closingCode - The closing code.closingReason - The closing reason.void websocketConnection(Object exchange, String endpointId, String peerId)
List<IWebsocketEndpointManager> getWebsocketEndpointManagers()
IWebsocketEndpointManager getWebsocketEndpointManager(String endpointId)
null if not found.Copyright © 2016. All rights reserved.