This commit is contained in:
@@ -123,7 +123,9 @@ public class NodeHttpServer extends NodeServer {
|
|||||||
|
|
||||||
protected void loadHttpServlet(final AnyValue servletsConf, final ClassFilter<? extends Servlet> filter) throws Exception {
|
protected void loadHttpServlet(final AnyValue servletsConf, final ClassFilter<? extends Servlet> filter) throws Exception {
|
||||||
final StringBuilder sb = logger.isLoggable(Level.INFO) ? new StringBuilder() : null;
|
final StringBuilder sb = logger.isLoggable(Level.INFO) ? new StringBuilder() : null;
|
||||||
final String prefix = servletsConf == null ? "" : servletsConf.getValue("path", "");
|
String prefix0 = servletsConf == null ? "" : servletsConf.getValue("path", "");
|
||||||
|
if (!prefix0.isEmpty() && prefix0.charAt(prefix0.length() - 1) == '/') prefix0 = prefix0.substring(0, prefix0.length() - 1);
|
||||||
|
final String prefix = prefix0;
|
||||||
final String threadName = "[" + Thread.currentThread().getName() + "] ";
|
final String threadName = "[" + Thread.currentThread().getName() + "] ";
|
||||||
List<FilterEntry<? extends Servlet>> list = new ArrayList(filter.getFilterEntrys());
|
List<FilterEntry<? extends Servlet>> list = new ArrayList(filter.getFilterEntrys());
|
||||||
list.sort((FilterEntry<? extends Servlet> o1, FilterEntry<? extends Servlet> o2) -> { //必须保证WebSocketServlet优先加载, 因为要确保其他的HttpServlet可以注入本地模式的WebSocketNode
|
list.sort((FilterEntry<? extends Servlet> o1, FilterEntry<? extends Servlet> o2) -> { //必须保证WebSocketServlet优先加载, 因为要确保其他的HttpServlet可以注入本地模式的WebSocketNode
|
||||||
|
|||||||
@@ -518,6 +518,10 @@ public abstract class WebSocket {
|
|||||||
public void onClose(int code, String reason) {
|
public void onClose(int code, String reason) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public long getLastSendTime() {
|
||||||
|
return this._runner == null ? 0 : this._runner.lastSendTime;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 显式地关闭WebSocket
|
* 显式地关闭WebSocket
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ public class WebSocketRunner implements Runnable {
|
|||||||
|
|
||||||
private final boolean wsbinary;
|
private final boolean wsbinary;
|
||||||
|
|
||||||
private long lastSendTime;
|
protected long lastSendTime;
|
||||||
|
|
||||||
public WebSocketRunner(Context context, WebSocket webSocket, AsyncConnection channel, final boolean wsbinary) {
|
public WebSocketRunner(Context context, WebSocket webSocket, AsyncConnection channel, final boolean wsbinary) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
|
|||||||
Reference in New Issue
Block a user