This commit is contained in:
@@ -41,7 +41,7 @@ public abstract class Filter<C extends Context, R extends Request<C>, P extends
|
||||
/**
|
||||
* 值越小越靠前执行
|
||||
*
|
||||
* @return
|
||||
* @return int
|
||||
*/
|
||||
public int getIndex() {
|
||||
return 0;
|
||||
|
||||
@@ -96,7 +96,7 @@ public final class MultiContext {
|
||||
* @param contentTypeReg 可接收的ContentType正则表达式
|
||||
*
|
||||
* @return 二进制文件
|
||||
* @throws IOException
|
||||
* @throws IOException IOException
|
||||
*/
|
||||
public byte[] partsFirstBytes(final long max, final String filenameReg, final String contentTypeReg) throws IOException {
|
||||
if (!isMultipart()) return null;
|
||||
@@ -118,7 +118,7 @@ public final class MultiContext {
|
||||
* @param contentTypeReg 可接收的ContentType正则表达式
|
||||
*
|
||||
* @return 文件
|
||||
* @throws IOException
|
||||
* @throws IOException IOException
|
||||
*/
|
||||
public File partsFirstFile(final File home, final long max, final String filenameReg, final String contentTypeReg) throws IOException {
|
||||
if (!isMultipart()) return null;
|
||||
@@ -153,7 +153,7 @@ public final class MultiContext {
|
||||
* @param contentTypeReg 可接收的ContentType正则表达式
|
||||
*
|
||||
* @return 文件列表
|
||||
* @throws IOException
|
||||
* @throws IOException IOException
|
||||
*/
|
||||
public File[] partsFiles(final File home, final long max, final String filenameReg, final String contentTypeReg) throws IOException {
|
||||
if (!isMultipart()) return null;
|
||||
|
||||
@@ -83,10 +83,10 @@ public abstract class WebSocketNode {
|
||||
* 获取目标地址 <br>
|
||||
* 该方法仅供内部调用
|
||||
*
|
||||
* @param targetAddress
|
||||
* @param groupid
|
||||
* @param targetAddress InetSocketAddress
|
||||
* @param groupid Serializable
|
||||
*
|
||||
* @return
|
||||
* @return 客户端地址列表
|
||||
*/
|
||||
protected CompletableFuture<List<String>> remoteWebSocketAddresses(@RpcTargetAddress InetSocketAddress targetAddress, Serializable groupid) {
|
||||
if (remoteNode == null) return CompletableFuture.completedFuture(null);
|
||||
@@ -102,7 +102,7 @@ public abstract class WebSocketNode {
|
||||
* 获取用户在线的SNCP节点地址列表,不是分布式则返回元素数量为1,且元素值为null的列表<br>
|
||||
* InetSocketAddress 为 SNCP节点地址
|
||||
*
|
||||
* @param groupid groupid
|
||||
* @param groupid Serializable
|
||||
*
|
||||
* @return 地址列表
|
||||
*/
|
||||
@@ -118,7 +118,7 @@ public abstract class WebSocketNode {
|
||||
* Map.key 为 SNCP节点地址, 含值为null的key表示没有分布式
|
||||
* Map.value 为 用户客户端的IP
|
||||
*
|
||||
* @param groupid groupid
|
||||
* @param groupid Serializable
|
||||
*
|
||||
* @return 地址集合
|
||||
*/
|
||||
|
||||
208
src/org/redkale/net/http/WebSocketService.java
Normal file
208
src/org/redkale/net/http/WebSocketService.java
Normal file
@@ -0,0 +1,208 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package org.redkale.net.http;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
import static java.lang.annotation.ElementType.*;
|
||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
|
||||
/**
|
||||
* 与RestService结合使用
|
||||
* <br><p>
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
*/
|
||||
public interface WebSocketService {
|
||||
|
||||
/**
|
||||
* 标记在WebSocketService的消息接收方法上
|
||||
*
|
||||
* <br><p>
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
*/
|
||||
@Inherited
|
||||
@Documented
|
||||
@Target({METHOD})
|
||||
@Retention(RUNTIME)
|
||||
public @interface RestOnMessage {
|
||||
|
||||
String comment() default ""; //备注描述
|
||||
}
|
||||
|
||||
/**
|
||||
* 标记在WebSocketService的方法上
|
||||
*
|
||||
* <br><p>
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
*/
|
||||
@Inherited
|
||||
@Documented
|
||||
@Target({METHOD})
|
||||
@Retention(RUNTIME)
|
||||
public @interface RestOnOpen {
|
||||
|
||||
String comment() default ""; //备注描述
|
||||
}
|
||||
|
||||
/**
|
||||
* 标记在WebSocketService的方法上 <br>
|
||||
* 方法的返回值必须是CompletableFuture<Serializable>, 且方法没有参数
|
||||
*
|
||||
* <br><p>
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
*/
|
||||
@Inherited
|
||||
@Documented
|
||||
@Target({METHOD})
|
||||
@Retention(RUNTIME)
|
||||
public @interface RestCreateGroup {
|
||||
|
||||
String comment() default ""; //备注描述
|
||||
}
|
||||
|
||||
/**
|
||||
* 标记在WebSocketService的方法上
|
||||
*
|
||||
* <br><p>
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
*/
|
||||
@Inherited
|
||||
@Documented
|
||||
@Target({METHOD})
|
||||
@Retention(RUNTIME)
|
||||
public @interface RestOnConnected {
|
||||
|
||||
String comment() default ""; //备注描述
|
||||
}
|
||||
|
||||
/**
|
||||
* 标记在WebSocketService的方法上
|
||||
*
|
||||
* <br><p>
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
*/
|
||||
@Inherited
|
||||
@Documented
|
||||
@Target({METHOD})
|
||||
@Retention(RUNTIME)
|
||||
public @interface RestOnClose {
|
||||
|
||||
String comment() default ""; //备注描述
|
||||
}
|
||||
|
||||
/**
|
||||
* 标记在WebSocketService的方法上
|
||||
*
|
||||
* <br><p>
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
*/
|
||||
@Inherited
|
||||
@Documented
|
||||
@Target({METHOD})
|
||||
@Retention(RUNTIME)
|
||||
public @interface RestOnPing {
|
||||
|
||||
String comment() default ""; //备注描述
|
||||
}
|
||||
|
||||
/**
|
||||
* 标记在WebSocketService的方法上
|
||||
*
|
||||
* <br><p>
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
*/
|
||||
@Inherited
|
||||
@Documented
|
||||
@Target({METHOD})
|
||||
@Retention(RUNTIME)
|
||||
public @interface RestOnPong {
|
||||
|
||||
String comment() default ""; //备注描述
|
||||
}
|
||||
|
||||
/**
|
||||
* 标记在WebSocketService的RestOnMessage方法的boolean参数上
|
||||
*
|
||||
* <br><p>
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
*/
|
||||
@Inherited
|
||||
@Documented
|
||||
@Target({PARAMETER})
|
||||
@Retention(RUNTIME)
|
||||
public @interface RestMessageLast {
|
||||
|
||||
String comment() default ""; //备注描述
|
||||
}
|
||||
|
||||
/**
|
||||
* 标记在WebSocketService的方法的String参数上
|
||||
*
|
||||
* <br><p>
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
*/
|
||||
@Inherited
|
||||
@Documented
|
||||
@Target({PARAMETER})
|
||||
@Retention(RUNTIME)
|
||||
public @interface RestClientAddress {
|
||||
|
||||
String comment() default ""; //备注描述
|
||||
}
|
||||
|
||||
/**
|
||||
* 标记在WebSocketService的RestOnMessage方法的Serializable参数上
|
||||
*
|
||||
* <br><p>
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
*/
|
||||
@Inherited
|
||||
@Documented
|
||||
@Target({PARAMETER})
|
||||
@Retention(RUNTIME)
|
||||
public @interface RestGroupid {
|
||||
|
||||
String comment() default ""; //备注描述
|
||||
}
|
||||
|
||||
/**
|
||||
* 标记在WebSocketService的方法的Serializable参数上
|
||||
*
|
||||
* <br><p>
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
*/
|
||||
@Inherited
|
||||
@Documented
|
||||
@Target({PARAMETER})
|
||||
@Retention(RUNTIME)
|
||||
public @interface RestSessionid {
|
||||
|
||||
String comment() default ""; //备注描述
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user