Package org.beryx.textio.web
Class RatpackDataServer
- java.lang.Object
-
- org.beryx.textio.web.AbstractDataServer<ratpack.handling.Context>
-
- org.beryx.textio.web.RatpackDataServer
-
- All Implemented Interfaces:
DataServer
public class RatpackDataServer extends AbstractDataServer<ratpack.handling.Context>
A Ratpack-based web server that allows clients to access theDataApi
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
RatpackDataServer.ContextHolder
-
Nested classes/interfaces inherited from class org.beryx.textio.web.AbstractDataServer
AbstractDataServer.ResponseData
-
-
Field Summary
Fields Modifier and Type Field Description protected ratpack.func.Action<ratpack.server.ServerConfigBuilder>
baseDirConfigurator
protected ratpack.func.Action<ratpack.handling.Chain>
handlerGetData
protected ratpack.func.Action<ratpack.handling.Chain>
handlerPostInit
protected ratpack.func.Action<ratpack.handling.Chain>
handlerPostInput
protected ratpack.func.Action<ratpack.handling.Chain>
handlerStaticAssets
protected ratpack.func.Action<ratpack.handling.Chain>
handlerTexttermAssets
protected ratpack.func.Action<ratpack.server.ServerConfigBuilder>
portConfigurator
-
Fields inherited from class org.beryx.textio.web.AbstractDataServer
DEFAULT_PATH_FOR_GET_DATA, DEFAULT_PATH_FOR_INIT_DATA, DEFAULT_PATH_FOR_POST_INPUT
-
-
Constructor Summary
Constructors Constructor Description RatpackDataServer(java.util.function.BiFunction<RatpackDataServer.ContextHolder,java.lang.String,DataApi> dataApiCreator, java.util.function.Function<RatpackDataServer.ContextHolder,DataApi> dataApiGetter)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<ratpack.func.Action<ratpack.guice.BindingsSpec>>
getBindings()
java.util.List<ratpack.func.Action<ratpack.server.ServerConfigBuilder>>
getConfigurators()
DataApiProvider<ratpack.handling.Context>
getDataApiProvider()
java.util.List<ratpack.func.Action<ratpack.handling.Chain>>
getHandlers()
protected static java.lang.String
getId(ratpack.handling.Context ctx)
int
getPort()
protected java.util.Optional<java.lang.String>
getResourceContent(java.lang.String resourceName)
protected java.util.Optional<java.lang.String>
getUrlContent(java.net.URL url)
void
init()
protected void
sendResponseData(ratpack.handling.Context ctx, AbstractDataServer.ResponseData r)
RatpackDataServer
withBaseDir(java.lang.String baseDir)
RatpackDataServer
withPort(int portNumber)
-
Methods inherited from class org.beryx.textio.web.AbstractDataServer
getPathForGetData, getPathForPostInit, getPathForPostInput, handle, handleGetData, handleInit, handlePostInput, withPathForGetData, withPathForInitData, withPathForPostInput
-
-
-
-
Field Detail
-
handlerPostInit
protected final ratpack.func.Action<ratpack.handling.Chain> handlerPostInit
-
handlerGetData
protected final ratpack.func.Action<ratpack.handling.Chain> handlerGetData
-
handlerPostInput
protected final ratpack.func.Action<ratpack.handling.Chain> handlerPostInput
-
handlerTexttermAssets
protected final ratpack.func.Action<ratpack.handling.Chain> handlerTexttermAssets
-
handlerStaticAssets
protected final ratpack.func.Action<ratpack.handling.Chain> handlerStaticAssets
-
portConfigurator
protected final ratpack.func.Action<ratpack.server.ServerConfigBuilder> portConfigurator
-
baseDirConfigurator
protected final ratpack.func.Action<ratpack.server.ServerConfigBuilder> baseDirConfigurator
-
-
Constructor Detail
-
RatpackDataServer
public RatpackDataServer(java.util.function.BiFunction<RatpackDataServer.ContextHolder,java.lang.String,DataApi> dataApiCreator, java.util.function.Function<RatpackDataServer.ContextHolder,DataApi> dataApiGetter)
-
-
Method Detail
-
getDataApiProvider
public DataApiProvider<ratpack.handling.Context> getDataApiProvider()
- Specified by:
getDataApiProvider
in classAbstractDataServer<ratpack.handling.Context>
-
getHandlers
public java.util.List<ratpack.func.Action<ratpack.handling.Chain>> getHandlers()
-
getBindings
public java.util.List<ratpack.func.Action<ratpack.guice.BindingsSpec>> getBindings()
-
getConfigurators
public java.util.List<ratpack.func.Action<ratpack.server.ServerConfigBuilder>> getConfigurators()
-
withBaseDir
public RatpackDataServer withBaseDir(java.lang.String baseDir)
-
withPort
public RatpackDataServer withPort(int portNumber)
-
getPort
public int getPort()
-
init
public void init()
-
sendResponseData
protected void sendResponseData(ratpack.handling.Context ctx, AbstractDataServer.ResponseData r)
-
getResourceContent
protected java.util.Optional<java.lang.String> getResourceContent(java.lang.String resourceName)
-
getUrlContent
protected java.util.Optional<java.lang.String> getUrlContent(java.net.URL url)
-
getId
protected static java.lang.String getId(ratpack.handling.Context ctx)
-
-