RestHeader支持InetSocketAddress类型
This commit is contained in:
@@ -11,6 +11,7 @@ import java.lang.annotation.*;
|
||||
import static java.lang.annotation.ElementType.*;
|
||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
import java.lang.reflect.*;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.nio.channels.CompletionHandler;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
@@ -1002,7 +1003,7 @@ public final class Rest {
|
||||
|
||||
RestHeader annhead = param.getAnnotation(RestHeader.class);
|
||||
if (annhead != null) {
|
||||
if (ptype != String.class) throw new RuntimeException("@RestHeader must on String Parameter in " + method);
|
||||
if (ptype != String.class && ptype != InetSocketAddress.class) throw new RuntimeException("@RestHeader must on String or InetSocketAddress Parameter in " + method);
|
||||
n = annhead.name();
|
||||
radix = annhead.radix();
|
||||
comment = annhead.comment();
|
||||
|
||||
@@ -10,7 +10,7 @@ import static java.lang.annotation.ElementType.*;
|
||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
|
||||
/**
|
||||
* 只能注解于RestService类的方法的参数或参数内的String字段
|
||||
* 只能注解于RestService类的方法的参数或参数内的String、java.net.InetSocketAddress字段
|
||||
* <p>
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
|
||||
27
src/org/redkale/net/http/WebSocketUserAddress.java
Normal file
27
src/org/redkale/net/http/WebSocketUserAddress.java
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* 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.io.Serializable;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* userid 与 sncpaddress组合对象
|
||||
*
|
||||
* <p>
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
*/
|
||||
public interface WebSocketUserAddress {
|
||||
|
||||
Serializable userid();
|
||||
|
||||
InetSocketAddress sncpAddress();
|
||||
|
||||
Collection<InetSocketAddress> sncpAddresses();
|
||||
}
|
||||
Reference in New Issue
Block a user