This commit is contained in:
@@ -68,7 +68,7 @@ public final class Rest {
|
|||||||
int mod = baseServletClass.getModifiers();
|
int mod = baseServletClass.getModifiers();
|
||||||
if (!java.lang.reflect.Modifier.isPublic(mod)) return null;
|
if (!java.lang.reflect.Modifier.isPublic(mod)) return null;
|
||||||
if (java.lang.reflect.Modifier.isAbstract(mod)) return null;
|
if (java.lang.reflect.Modifier.isAbstract(mod)) return null;
|
||||||
|
|
||||||
final String serviceDesc = Type.getDescriptor(serviceType);
|
final String serviceDesc = Type.getDescriptor(serviceType);
|
||||||
final String webServletDesc = Type.getDescriptor(WebServlet.class);
|
final String webServletDesc = Type.getDescriptor(WebServlet.class);
|
||||||
final String reqDesc = Type.getDescriptor(HttpRequest.class);
|
final String reqDesc = Type.getDescriptor(HttpRequest.class);
|
||||||
@@ -180,6 +180,7 @@ public final class Rest {
|
|||||||
if (EXCLUDERMETHODS.contains(method.getName())) continue;
|
if (EXCLUDERMETHODS.contains(method.getName())) continue;
|
||||||
if ("init".equals(method.getName())) continue;
|
if ("init".equals(method.getName())) continue;
|
||||||
if ("destroy".equals(method.getName())) continue;
|
if ("destroy".equals(method.getName())) continue;
|
||||||
|
if ("version".equals(method.getName())) continue;
|
||||||
|
|
||||||
RestMapping[] mappings = method.getAnnotationsByType(RestMapping.class);
|
RestMapping[] mappings = method.getAnnotationsByType(RestMapping.class);
|
||||||
boolean ignore = false;
|
boolean ignore = false;
|
||||||
|
|||||||
@@ -177,6 +177,7 @@ public final class SncpClient {
|
|||||||
if (method.getName().equals("equals") || method.getName().equals("hashCode")) continue;
|
if (method.getName().equals("equals") || method.getName().equals("hashCode")) continue;
|
||||||
if (method.getName().equals("notify") || method.getName().equals("notifyAll") || method.getName().equals("wait")) continue;
|
if (method.getName().equals("notify") || method.getName().equals("notifyAll") || method.getName().equals("wait")) continue;
|
||||||
if (method.getName().equals("init") || method.getName().equals("destroy")) continue;
|
if (method.getName().equals("init") || method.getName().equals("destroy")) continue;
|
||||||
|
if (method.getName().equals("version") || method.getName().equals("name")) continue;
|
||||||
//if (onlySncpDyn && method.getAnnotation(SncpDyn.class) == null) continue;
|
//if (onlySncpDyn && method.getAnnotation(SncpDyn.class) == null) continue;
|
||||||
DLong actionid = Sncp.hash(method);
|
DLong actionid = Sncp.hash(method);
|
||||||
Method old = actionids.get(actionid);
|
Method old = actionids.get(actionid);
|
||||||
|
|||||||
@@ -62,7 +62,8 @@ public final class SncpDynServlet extends SncpServlet {
|
|||||||
if (method.getName().equals("getClass") || method.getName().equals("toString")) continue;
|
if (method.getName().equals("getClass") || method.getName().equals("toString")) continue;
|
||||||
if (method.getName().equals("equals") || method.getName().equals("hashCode")) continue;
|
if (method.getName().equals("equals") || method.getName().equals("hashCode")) continue;
|
||||||
if (method.getName().equals("notify") || method.getName().equals("notifyAll") || method.getName().equals("wait")) continue;
|
if (method.getName().equals("notify") || method.getName().equals("notifyAll") || method.getName().equals("wait")) continue;
|
||||||
if (method.getName().equals("init") || method.getName().equals("destroy") || method.getName().equals("name")) continue;
|
if (method.getName().equals("init") || method.getName().equals("destroy")) continue;
|
||||||
|
if (method.getName().equals("version") || method.getName().equals("name")) continue;
|
||||||
final DLong actionid = Sncp.hash(method);
|
final DLong actionid = Sncp.hash(method);
|
||||||
SncpServletAction action = SncpServletAction.create(service, actionid, method);
|
SncpServletAction action = SncpServletAction.create(service, actionid, method);
|
||||||
action.convert = convert;
|
action.convert = convert;
|
||||||
@@ -182,9 +183,9 @@ public final class SncpDynServlet extends SncpServlet {
|
|||||||
* }
|
* }
|
||||||
* </pre></blockquote>
|
* </pre></blockquote>
|
||||||
*
|
*
|
||||||
* @param service Service
|
* @param service Service
|
||||||
* @param actionid 操作ID
|
* @param actionid 操作ID
|
||||||
* @param method 方法
|
* @param method 方法
|
||||||
*
|
*
|
||||||
* @return SncpServletAction
|
* @return SncpServletAction
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import org.redkale.util.*;
|
|||||||
/**
|
/**
|
||||||
* 所有Service的实现类不得声明为final, 允许远程模式的public方法都不能声明为final。
|
* 所有Service的实现类不得声明为final, 允许远程模式的public方法都不能声明为final。
|
||||||
* 注意: "$"是一个很特殊的Service.name值 。 被标记为@Resource(name = "$") 的Service的资源名与所属父Service的资源名一致。
|
* 注意: "$"是一个很特殊的Service.name值 。 被标记为@Resource(name = "$") 的Service的资源名与所属父Service的资源名一致。
|
||||||
*
|
*
|
||||||
* <blockquote><pre>
|
* <blockquote><pre>
|
||||||
* Service的资源类型
|
* Service的资源类型
|
||||||
* 业务逻辑的Service通常有两种编写方式:
|
* 业务逻辑的Service通常有两种编写方式:
|
||||||
@@ -18,7 +18,7 @@ import org.redkale.util.*;
|
|||||||
* 2、先定义业务的Service接口或抽象类,再编写具体实现类。
|
* 2、先定义业务的Service接口或抽象类,再编写具体实现类。
|
||||||
* 第二种方式需要在具体实现类上使用@ResourceType指明资源注入的类型。
|
* 第二种方式需要在具体实现类上使用@ResourceType指明资源注入的类型。
|
||||||
* </pre></blockquote>
|
* </pre></blockquote>
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* 详情见: http://redkale.org
|
* 详情见: http://redkale.org
|
||||||
*
|
*
|
||||||
@@ -44,4 +44,14 @@ public interface Service {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Service的接口版本号
|
||||||
|
* <b>注: public方法的参数或返回类型或参数类型内部变更后改值必须进行改变</b>
|
||||||
|
*
|
||||||
|
* @return 接口版本号
|
||||||
|
*/
|
||||||
|
default int version() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user