public class SolonApp extends RouterWrapper
限定符和类型 | 方法和说明 |
---|---|
protected void |
beanImportTry() |
void |
block()
锁住线程(如果有需要,建议在启动程序的最后调用)
|
SolonProps |
cfg()
应用属性(或配置)
|
java.lang.ClassLoader |
classLoader()
类加载器
|
AppContext |
context()
应用上下文
|
ConverterManager |
converterManager()
转换管理器
|
protected boolean |
doStatus(Context x) |
protected long |
elapsedTimes()
从启动开启已运行时间
|
boolean |
enableCaching()
是否已启用缓存
|
SolonApp |
enableCaching(boolean enable)
启用缓存
|
boolean |
enableHttp()
是否已启用 Http 信号接入
|
SolonApp |
enableHttp(boolean enable)
启用 Http 信号接入
|
boolean |
enableScanning()
是否已启用扫描
|
SolonApp |
enableScanning(boolean enable)
启用扫描
|
boolean |
enableSessionState()
是否已启用会话状态
|
SolonApp |
enableSessionState(boolean enable)
启用会话状态
|
boolean |
enableSocketD()
是否已启用 SocketD 信号接入
|
SolonApp |
enableSocketD(boolean enable)
启用 SocketD 信号接入
|
boolean |
enableStaticfiles()
是否已启用静态文件服务
|
SolonApp |
enableStaticfiles(boolean enable)
启用静态文件服务
|
boolean |
enableTransaction()
是否已启用事务
|
SolonApp |
enableTransaction(boolean enable)
启用事务
|
boolean |
enableWebSocket() |
SolonApp |
enableWebSocket(boolean enable)
启用 WebSocket 信号接入
|
FactoryManager |
factoryManager()
工厂管理器
|
HandlerPipeline |
handler()
处理器获取
|
protected boolean |
isMain()
是否为主应用对象
|
<T> SolonApp |
onEvent(java.lang.Class<T> type,
EventListener<T> handler)
订阅事件
|
<T> SolonApp |
onEvent(java.lang.Class<T> type,
int index,
EventListener<T> handler)
订阅事件
|
void |
onSharedAdd(java.util.function.BiConsumer<java.lang.String,java.lang.Object> event)
共享对象添加事件
|
SolonApp |
onStatus(java.lang.Integer code,
Handler handler)
订阅异常状态
|
void |
plug(Plugin plugin)
插入插件(一般用于动态加载,比如 faas)
|
void |
pluginAdd(int priority,
Plugin plugin)
添加插件(只有执行前添加才有效)
|
void |
pluginExclude(java.lang.Class<?> pluginClz)
插件排除
|
void |
pluginExclude(java.lang.String pluginClzName)
插件排除
|
protected void |
prestopDo()
预停止
|
RenderManager |
renderManager()
渲染管理器
|
SerializerManager |
serializerManager()
序列化管理器
|
java.util.Map<java.lang.String,java.lang.Object> |
shared()
共享对象
|
void |
sharedAdd(java.lang.String key,
java.lang.Object obj)
添加共享对象
|
<T> void |
sharedGet(java.lang.String key,
java.util.function.Consumer<T> event)
获取共享对象(异步获取)
|
void |
signalAdd(Signal instance)
添加信号
|
Signal |
signalGet(int port)
获取信号
|
java.util.Collection<Signal> |
signals()
获取信号记录
|
java.lang.Class<?> |
source()
启动入口类
|
java.net.URL |
sourceLocation()
启动入口类所在位置
|
protected void |
startDo(ConsumerEx<SolonApp> initialize)
启动
|
protected void |
stopDo()
停止
|
protected void |
stoppingDo() |
void |
tryHandle(Context x)
应用请求处理入口(异常时,自动500处理)
|
add, add, add, add, all, chainManager, delete, filter, filter, filterIfAbsent, get, head, http, initRouter, patch, post, put, render, render, renderOfJson, router, routerHandler, routerInterceptor, routerInterceptor, routerInterceptorIfAbsent, socketd
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
add
protected SolonApp(java.lang.Class<?> source, NvMap args) throws java.lang.Exception
java.lang.Exception
public AppContext context()
context
在类中 RouterWrapper
public ConverterManager converterManager()
public SerializerManager serializerManager()
public RenderManager renderManager()
public FactoryManager factoryManager()
public SolonProps cfg()
protected boolean isMain()
protected void startDo(ConsumerEx<SolonApp> initialize) throws java.lang.Throwable
java.lang.Throwable
protected void prestopDo()
protected void stoppingDo()
protected void stopDo()
protected void beanImportTry()
public void signalAdd(Signal instance)
public Signal signalGet(int port)
port
- 端口public java.util.Collection<Signal> signals()
public java.lang.ClassLoader classLoader()
public void sharedAdd(java.lang.String key, java.lang.Object obj)
public <T> void sharedGet(java.lang.String key, java.util.function.Consumer<T> event)
public void onSharedAdd(java.util.function.BiConsumer<java.lang.String,java.lang.Object> event)
public java.util.Map<java.lang.String,java.lang.Object> shared()
protected long elapsedTimes()
public java.lang.Class<?> source()
public java.net.URL sourceLocation()
public void plug(Plugin plugin)
public void pluginAdd(int priority, Plugin plugin)
priority
- 优先级(越大越优化)plugin
- 插件public void pluginExclude(java.lang.Class<?> pluginClz)
public void pluginExclude(java.lang.String pluginClzName)
public HandlerPipeline handler()
public void tryHandle(Context x)
protected boolean doStatus(Context x) throws java.lang.Throwable
java.lang.Throwable
public <T> SolonApp onEvent(java.lang.Class<T> type, EventListener<T> handler)
public <T> SolonApp onEvent(java.lang.Class<T> type, int index, EventListener<T> handler)
public void block() throws java.lang.InterruptedException
java.lang.InterruptedException
public boolean enableHttp()
public SolonApp enableHttp(boolean enable)
public boolean enableWebSocket()
public SolonApp enableWebSocket(boolean enable)
enable
- 是否启用public boolean enableSocketD()
public SolonApp enableSocketD(boolean enable)
enable
- 是否启用public boolean enableTransaction()
public SolonApp enableTransaction(boolean enable)
enable
- 是否启用public boolean enableCaching()
public SolonApp enableCaching(boolean enable)
enable
- 是否启用public boolean enableScanning()
public SolonApp enableScanning(boolean enable)
enable
- 是否启用public boolean enableStaticfiles()
public SolonApp enableStaticfiles(boolean enable)
enable
- 是否启用public boolean enableSessionState()
public SolonApp enableSessionState(boolean enable)
enable
- 是否启用