+ *
* 详情见: https://redkale.org
*
* @author zhangjx
@@ -31,12 +31,17 @@ public class AnyDecoder implements Decodeable
+ *
* 详情见: https://redkale.org
*
* @author zhangjx
@@ -42,29 +41,6 @@ public final class AnyEncoder
* 详情见: https://redkale.org
@@ -29,7 +29,7 @@ import org.redkale.util.*;
* @since 2.3.0
*
*/
-public class HttpClient {
+public class HttpSimpleClient {
protected final AsyncGroup asyncGroup;
@@ -37,12 +37,12 @@ public class HttpClient {
protected int writeTimeoutSeconds = 6;
- protected HttpClient(AsyncGroup asyncGroup) {
+ protected HttpSimpleClient(AsyncGroup asyncGroup) {
this.asyncGroup = asyncGroup;
}
- public static HttpClient create(AsyncGroup asyncGroup) {
- return new HttpClient(asyncGroup);
+ public static HttpSimpleClient create(AsyncGroup asyncGroup) {
+ return new HttpSimpleClient(asyncGroup);
}
public CompletableFuture
+ * 详情见: https://redkale.org
+ *
+ * @author zhangjx
+ */
+@AutoLoad(false)
+@ResourceType(WebSocketNode.class)
+public class WebSocketNodeService extends WebSocketNode implements Service {
+
+ @Override
+ public void init(AnyValue conf) {
+ super.init(conf);
+ }
+
+ @Override
+ public void destroy(AnyValue conf) {
+ super.destroy(conf);
+ }
+
+ public final void setName(String name) {
+ this.name = name;
+ }
+
+ @Override
+ public CompletableFuture
* 详情见: https://redkale.org
*
+ * @deprecated 2.6.0
* @author zhangjx
*/
+@Deprecated
@AutoLoad(false)
@ResourceType(WebSocketNode.class)
-public class WebSocketNodeService extends WebSocketNode implements Service {
+public class WebSocketNodeService extends org.redkale.net.http.WebSocketNodeService {
- @Override
- public void init(AnyValue conf) {
- super.init(conf);
- }
-
- @Override
- public void destroy(AnyValue conf) {
- super.destroy(conf);
- }
-
- public final void setName(String name) {
- this.name = name;
- }
-
- @Override
- public CompletableFuture
+ *
* 详情见: https://redkale.org
*
* @author zhangjx
@@ -30,39 +30,121 @@ import org.redkale.util.*;
@ResourceType(DataSource.class)
public abstract class AbstractDataSource extends AbstractService implements DataSource, AutoCloseable, Resourcable {
+ /**
+ * 是否虚拟化的持久对象
+ *
+ * @param info EntityInfo
+ *
+ * @return boolean
+ */
protected boolean isOnlyCache(EntityInfo info) {
return info.isVirtualEntity();
}
+ /**
+ * 是否可以使用缓存,一般包含关联查询就不使用缓存
+ *
+ * @param node 过滤条件
+ * @param entityApplyer 函数
+ *
+ * @return boolean
+ */
protected boolean isCacheUseable(FilterNode node, Function
+ *
* @param
* More formally, if this map contains a mapping from a key {@code k} to
@@ -552,6 +557,8 @@ public class NonBlockingHashMap
* 2、上传下载文件;
* 3、返回超大响应包;
- * 类似JDK11的 java.net.http.HttpClient
+ * 类似JDK11的 java.net.http.HttpSimpleClient
*
*
+ * 值"*" 表示参数中不包含方法名
*
* @return String
*/
diff --git a/src/main/java/org/redkale/net/http/WebSocket.java b/src/main/java/org/redkale/net/http/WebSocket.java
index f459aacbc..d927bd595 100644
--- a/src/main/java/org/redkale/net/http/WebSocket.java
+++ b/src/main/java/org/redkale/net/http/WebSocket.java
@@ -106,7 +106,7 @@ public abstract class WebSocket> getWebSocketAddresses(@RpcTargetTopic String topic, final @RpcTargetAddress InetSocketAddress targetAddress, final Serializable groupid) {
+ if ((topic == null || !topic.equals(this.wsNodeAddress.getTopic())) && (localSncpAddress == null || !localSncpAddress.equals(targetAddress))) return remoteWebSocketAddresses(topic, targetAddress, groupid);
+ if (this.localEngine == null) return CompletableFuture.completedFuture(new ArrayList<>());
+ final List
> getWebSocketAddresses(@RpcTargetTopic String topic, final @RpcTargetAddress InetSocketAddress targetAddress, final Serializable groupid) {
- if ((topic == null || !topic.equals(this.wsNodeAddress.getTopic())) && (localSncpAddress == null || !localSncpAddress.equals(targetAddress))) return remoteWebSocketAddresses(topic, targetAddress, groupid);
- if (this.localEngine == null) return CompletableFuture.completedFuture(new ArrayList<>());
- final List
* 注意: 所有的操作只能作用在一张表上,不能同时变更多张表
*
- *
+ * websocket.send(JSON.stringify({
+ * roomid: 10212
+ * name: "haha"
+ * }));
+ *
+ *
+ * @param roomid 参数1
+ * @param name 参数2
+ */
+ @RestOnMessage(name = "*") //*为特殊值表示参数中不包含方法名
+ public void other(int roomid, String name) {
+ service.other(roomid, name);
+ }
+
}
diff --git a/src/test/java/org/redkale/test/wsdync/_DyncChatWebSocketServlet.java b/src/test/java/org/redkale/test/wsdync/_DyncChatWebSocketServlet.java
index b5017ae72..9e1ce6e2e 100644
--- a/src/test/java/org/redkale/test/wsdync/_DyncChatWebSocketServlet.java
+++ b/src/test/java/org/redkale/test/wsdync/_DyncChatWebSocketServlet.java
@@ -31,7 +31,7 @@ public final class _DyncChatWebSocketServlet extends WebSocketServlet {
public _DyncChatWebSocketServlet() {
super();
- this.messageTextType = _DyncChatWebSocketMessage.class;
+ this.messageRestType = _DyncChatWebSocketMessage.class;
}
@Override
@@ -52,12 +52,48 @@ public final class _DyncChatWebSocketServlet extends WebSocketServlet {
}
}
- public static class _DyncChatWebSocketMessage {
+ public static class _DyncChatWebSocketMessage implements WebSocketParam, Runnable {
public _DyncChatWebSocketMessage_sendmessagee_00 sendmessage;
public _DyncChatWebSocketMessage_joinroom_01 joinroom;
+ @ConvertDisabled
+ public _DyncChatWebSocket _redkale_websocket;
+
+ public int roomid;
+
+ public String name;
+
+ @Override
+ public String[] getNames() {
+ return new String[]{"roomid", "name"};
+ }
+
+ @Override
+ public