| Modifier and Type | Field and Description |
|---|---|
protected org.slf4j.Logger |
logger |
static String |
UNDERTOW_EXCEPTION_CODE_REQUEST_TOO_LARGE |
| Constructor and Description |
|---|
SpincastUndertowServer(ISpincastConfig config,
ISpincastUndertowConfig spincastUndertowConfig,
IFrontController frontController,
ISpincastUtils spincastUtils,
ICookieFactory cookieFactory,
ICorsHandlerFactory corsHandlerFactory,
IGzipCheckerHandlerFactory gzipCheckerHandlerFactory,
IFileClassPathResourceManagerFactory fileClassPathResourceManagerFactory,
ISpincastHttpAuthIdentityManagerFactory spincastHttpAuthIdentityManagerFactory,
IWebsocketEndpointFactory spincastWebsocketEndpointFactory,
ISSLContextFactory sslContextFactory)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
protected io.undertow.Undertow.Builder |
addBuilderOptions(io.undertow.Undertow.Builder builder) |
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.
|
protected void |
addHttpListener(io.undertow.Undertow.Builder builder,
String serverHost,
int httpServerPort) |
protected void |
addHttpsListener(io.undertow.Undertow.Builder builder,
String serverHost,
int httpsServerPort) |
void |
addStaticResourceToServe(IStaticResource<?> staticResource)
Adds a static resource to serve directly by the server.
|
protected io.undertow.server.HttpServerExchange |
castExchange(Object exchange) |
void |
createHttpAuthenticationRealm(String pathPrefix,
String realmName)
Creates HTTP authentication protection (realm) for the
specified path prefix.
|
protected IWebsocketEndpointHandler |
createUndertowWebsocketEndpointHandler(String endpointId,
IWebsocketEndpointHandler appHandler) |
void |
end(Object exchange)
Ends the exchange.
|
void |
flushBytes(Object exchange,
byte[] bytes,
boolean end)
Flushes some bytes to the response.
|
boolean |
forceRequestSizeValidation(Object exchangeObj)
Is the request size valid?
|
protected io.undertow.io.IoCallback |
getCloseExchangeCallback() |
protected ISpincastConfig |
getConfig() |
ContentTypeDefaults |
getContentTypeBestMatch(Object exchangeObj)
Gets the best
Content-Type to use for the current request. |
protected String |
getCookieEncoding() |
protected ICookieFactory |
getCookieFactory() |
Map<String,ICookie> |
getCookies(Object exchange)
Gets the current cookies.
|
protected ICorsHandlerFactory |
getCorsHandlerFactory() |
protected io.undertow.io.IoCallback |
getDoNothingCallback() |
protected IFileClassPathResourceManagerFactory |
getFileClassPathResourceManagerFactory() |
protected io.undertow.server.HttpHandler |
getFinalHandler()
The very first handler considered by Undertow.
|
protected io.undertow.server.handlers.form.FormData |
getFormData(io.undertow.server.HttpServerExchange exchange)
May return NULL.
|
Map<String,List<String>> |
getFormDatas(Object exchangeObj)
The form datas, if any.
|
protected io.undertow.server.handlers.form.FormParserFactory |
getFormParserFactory() |
protected IFrontController |
getFrontController() |
String |
getFullUrl(Object exchangeObj)
The full encoded URL of the original request, including the queryString.
|
protected IGzipCheckerHandlerFactory |
getGzipCheckerHandlerFactory() |
protected Map<String,String> |
getHttpAuthActiveRealms() |
protected io.undertow.server.handlers.PathHandler |
getHttpAuthenticationHandler()
Handler to check for HTTP authentication requirement.
|
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.
|
protected io.undertow.server.HttpHandler |
getHttpAuthHandlerNextHandler() |
protected Map<String,ISpincastHttpAuthIdentityManager> |
getHttpAuthIdentityManagersByRealmName() |
HttpMethod |
getHttpMethod(Object exchange)
Gets the HTTP method associated with the request.
|
protected ISpincastHttpAuthIdentityManager |
getOrCreateHttpAuthIdentityManagersByRealmName(String realmName) |
Map<String,List<String>> |
getQueryStringParams(Object exchange)
Gets the queryString parameters.
|
InputStream |
getRawInputStream(Object exchangeObj)
The raw InputStream of the current request.
|
protected String |
getRealmNameToDisplay(String pathPrefix,
String realmName)
The realm name to display.
|
Map<String,List<String>> |
getRequestHeaders(Object exchangeObj)
The headers from the request.
|
String |
getRequestScheme(Object exchange)
Gets the request scheme, "http" for example.
|
Map<String,List<String>> |
getResponseHeaders(Object exchangeObj)
Gets the response headers.
|
protected io.undertow.Undertow.Builder |
getServerBuilder() |
protected int |
getServerStartTryNbr() |
protected io.undertow.server.HttpHandler |
getSpincastFrontControllerHandler() |
protected ISpincastHttpAuthIdentityManagerFactory |
getSpincastHttpAuthIdentityManagerFactory() |
protected ISpincastUndertowConfig |
getSpincastUndertowConfig() |
protected ISpincastUtils |
getSpincastUtils() |
protected IWebsocketEndpointFactory |
getSpincastWebsocketEndpointFactory() |
protected ISSLContextFactory |
getSslContextFactory() |
protected long |
getStartServerSleepMilliseconds() |
IStaticResource<?> |
getStaticResourceServed(String urlPath)
Gets a static resource served directly by the server, using its path.
|
protected io.undertow.server.handlers.PathHandler |
getStaticResourcesPathHandler() |
Set<IStaticResource<?>> |
getStaticResourcesServed()
Gets all static resource served directly by the server.
|
protected Map<String,IStaticResource<?>> |
getStaticResourcesServedByUrlPath() |
Map<String,List<File>> |
getUploadedFiles(Object exchangeObj)
The uploaded files, if any.
|
protected Object |
getWebsocketEndpointCreationLock(String endpointId)
Gets the creation/close lock for a specific Websocket endpoint.
|
IWebsocketEndpointManager |
getWebsocketEndpointManager(String endpointId)
Returns the manager for a Websockets endpoint.
|
List<IWebsocketEndpointManager> |
getWebsocketEndpointManagers()
Returns the managers of the existing Websockets endpoints.
|
protected Map<String,IWebsocketEndpoint> |
getWebsocketEndpointsMap() |
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.
|
protected void |
removeStaticResource(StaticResourceType staticResourceType,
String urlPath) |
void |
removeStaticResourcesServed(StaticResourceType staticResourceType,
String urlPath)
Removes a static resource served directly by the server.
|
protected void |
sendWebsocketEnpointsClosedWhenServerStops() |
void |
setResponseHeader(Object exchangeObj,
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 exchangeObj,
String endpointId,
String peerId)
Transforms the request to a peer Websocket connection
on the endpoint 'endpointId'.
|
IWebsocketEndpointManager |
websocketCreateEndpoint(String endpointId,
IWebsocketEndpointHandler appEndpointHandler)
Creates a new Websocket endpoint.
|
protected final org.slf4j.Logger logger
public static final String UNDERTOW_EXCEPTION_CODE_REQUEST_TOO_LARGE
@Inject public SpincastUndertowServer(ISpincastConfig config, ISpincastUndertowConfig spincastUndertowConfig, IFrontController frontController, ISpincastUtils spincastUtils, ICookieFactory cookieFactory, ICorsHandlerFactory corsHandlerFactory, IGzipCheckerHandlerFactory gzipCheckerHandlerFactory, IFileClassPathResourceManagerFactory fileClassPathResourceManagerFactory, ISpincastHttpAuthIdentityManagerFactory spincastHttpAuthIdentityManagerFactory, IWebsocketEndpointFactory spincastWebsocketEndpointFactory, ISSLContextFactory sslContextFactory)
protected ISpincastConfig getConfig()
protected ISpincastUndertowConfig getSpincastUndertowConfig()
protected IFrontController getFrontController()
protected ISpincastUtils getSpincastUtils()
protected ICookieFactory getCookieFactory()
protected ICorsHandlerFactory getCorsHandlerFactory()
protected IGzipCheckerHandlerFactory getGzipCheckerHandlerFactory()
protected IFileClassPathResourceManagerFactory getFileClassPathResourceManagerFactory()
protected ISpincastHttpAuthIdentityManagerFactory getSpincastHttpAuthIdentityManagerFactory()
protected IWebsocketEndpointFactory getSpincastWebsocketEndpointFactory()
protected Map<String,IStaticResource<?>> getStaticResourcesServedByUrlPath()
protected Map<String,ISpincastHttpAuthIdentityManager> getHttpAuthIdentityManagersByRealmName()
protected Map<String,IWebsocketEndpoint> getWebsocketEndpointsMap()
protected ISSLContextFactory getSslContextFactory()
public Map<String,String> getHttpAuthenticationRealms()
IServerThe map is immutable.
getHttpAuthenticationRealms in interface IServerprotected io.undertow.server.handlers.form.FormParserFactory getFormParserFactory()
public void start()
IServerprotected int getServerStartTryNbr()
protected long getStartServerSleepMilliseconds()
protected io.undertow.Undertow.Builder getServerBuilder()
protected void addHttpListener(io.undertow.Undertow.Builder builder,
String serverHost,
int httpServerPort)
protected void addHttpsListener(io.undertow.Undertow.Builder builder,
String serverHost,
int httpsServerPort)
protected io.undertow.Undertow.Builder addBuilderOptions(io.undertow.Undertow.Builder builder)
protected io.undertow.server.HttpHandler getFinalHandler()
protected io.undertow.server.handlers.PathHandler getHttpAuthenticationHandler()
protected io.undertow.server.HttpHandler getHttpAuthHandlerNextHandler()
public void createHttpAuthenticationRealm(String pathPrefix, String realmName)
IServercreateHttpAuthenticationRealm in interface IServerrealmName - 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.protected String getRealmNameToDisplay(String pathPrefix, String realmName)
protected ISpincastHttpAuthIdentityManager getOrCreateHttpAuthIdentityManagersByRealmName(String realmName)
public void addHttpAuthentication(String realmName, String username, String password)
IServeraddHttpAuthentication in interface IServerpublic void removeHttpAuthentication(String username, String realmName)
IServerremoveHttpAuthentication in interface IServerpublic void removeHttpAuthentication(String username)
IServerremoveHttpAuthentication in interface IServerprotected io.undertow.server.HttpHandler getSpincastFrontControllerHandler()
public void stop()
IServerprotected void sendWebsocketEnpointsClosedWhenServerStops()
protected io.undertow.server.handlers.PathHandler getStaticResourcesPathHandler()
public void addStaticResourceToServe(IStaticResource<?> staticResource)
IServeraddStaticResourceToServe in interface IServerpublic void removeStaticResourcesServed(StaticResourceType staticResourceType, String urlPath)
IServerremoveStaticResourcesServed in interface IServerpublic void removeAllStaticResourcesServed()
IServerremoveAllStaticResourcesServed in interface IServerprotected void removeStaticResource(StaticResourceType staticResourceType, String urlPath)
public IStaticResource<?> getStaticResourceServed(String urlPath)
IServergetStaticResourceServed in interface IServerpublic Set<IStaticResource<?>> getStaticResourcesServed()
IServergetStaticResourcesServed in interface IServerpublic HttpMethod getHttpMethod(Object exchange)
IServergetHttpMethod in interface IServerprotected io.undertow.server.HttpServerExchange castExchange(Object exchange)
public ContentTypeDefaults getContentTypeBestMatch(Object exchangeObj)
IServerContent-Type to use for the current request.getContentTypeBestMatch in interface IServerpublic String getFullUrl(Object exchangeObj)
IServergetFullUrl in interface IServerpublic void setResponseHeader(Object exchangeObj, String name, List<String> values)
IServersetResponseHeader in interface IServerpublic void setResponseHeaders(Object exchange, Map<String,List<String>> headers)
IServersetResponseHeaders in interface IServerpublic Map<String,List<String>> getResponseHeaders(Object exchangeObj)
IServergetResponseHeaders in interface IServerpublic void removeResponseHeader(Object exchange, String name)
IServerremoveResponseHeader in interface IServerpublic void setResponseStatusCode(Object exchange, int statusCode)
IServersetResponseStatusCode in interface IServerprotected io.undertow.io.IoCallback getDoNothingCallback()
protected io.undertow.io.IoCallback getCloseExchangeCallback()
public void flushBytes(Object exchange, byte[] bytes, boolean end)
IServerflushBytes in interface IServerend - if true, the exchange will be closed
and nothing more can be send.public void end(Object exchange)
IServerpublic boolean isResponseClosed(Object exchange)
IServerisResponseClosed in interface IServerpublic boolean isResponseHeadersSent(Object exchange)
IServerisResponseHeadersSent in interface IServerpublic String getRequestScheme(Object exchange)
IServergetRequestScheme in interface IServerpublic void addCookies(Object exchange, Map<String,ICookie> cookies)
IServeraddCookies in interface IServerpublic Map<String,ICookie> getCookies(Object exchange)
IServergetCookies in interface IServerprotected String getCookieEncoding()
public Map<String,List<String>> getQueryStringParams(Object exchange)
IServergetQueryStringParams in interface IServerpublic InputStream getRawInputStream(Object exchangeObj)
IServergetRawInputStream in interface IServerprotected io.undertow.server.handlers.form.FormData getFormData(io.undertow.server.HttpServerExchange exchange)
public Map<String,List<String>> getFormDatas(Object exchangeObj)
IServergetFormDatas in interface IServerpublic Map<String,List<File>> getUploadedFiles(Object exchangeObj)
IServergetUploadedFiles in interface IServerpublic boolean forceRequestSizeValidation(Object exchangeObj)
IServerforceRequestSizeValidation in interface IServerpublic Map<String,List<String>> getRequestHeaders(Object exchangeObj)
IServergetRequestHeaders in interface IServerprotected Object getWebsocketEndpointCreationLock(String endpointId)
public IWebsocketEndpointManager websocketCreateEndpoint(String endpointId, IWebsocketEndpointHandler appEndpointHandler)
IServerwebsocketCreateEndpoint in interface IServerprotected IWebsocketEndpointHandler createUndertowWebsocketEndpointHandler(String endpointId, IWebsocketEndpointHandler appHandler)
public void websocketCloseEndpoint(String endpointId)
IServerwebsocketCloseEndpoint in interface IServerpublic void websocketCloseEndpoint(String endpointId, int closingCode, String closingReason)
IServerwebsocketCloseEndpoint in interface IServerclosingCode - The closing code.closingReason - The closing reason.public void websocketConnection(Object exchangeObj, String endpointId, String peerId)
IServerwebsocketConnection in interface IServerpublic List<IWebsocketEndpointManager> getWebsocketEndpointManagers()
IServergetWebsocketEndpointManagers in interface IServerpublic IWebsocketEndpointManager getWebsocketEndpointManager(String endpointId)
IServergetWebsocketEndpointManager in interface IServernull if not found.Copyright © 2016. All rights reserved.