RestHeader支持InetSocketAddress类型

This commit is contained in:
Redkale
2019-08-28 14:31:33 +08:00
parent b0deed2a89
commit a495829a3c
3 changed files with 30 additions and 2 deletions

View File

@@ -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();

View File

@@ -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
*

View 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();
}