diff --git a/src/main/java/org/redkale/boot/ApiDocCommand.java b/src/main/java/org/redkale/boot/ApiDocCommand.java index ad08b0c06..b5f5dcb8c 100644 --- a/src/main/java/org/redkale/boot/ApiDocCommand.java +++ b/src/main/java/org/redkale/boot/ApiDocCommand.java @@ -155,7 +155,7 @@ public final class ApiDocCommand { if (HttpScope.class.isAssignableFrom(action.result())) { continue; //忽略模板引擎的方法 } - if (action.rpconly() && skipRPC) { + if (action.rpcOnly() && skipRPC) { continue; //不生成RPC接口 } final List> swaggerParamsList = new ArrayList<>(); @@ -347,7 +347,7 @@ public final class ApiDocCommand { } swaggerOperatMap.put("parameters", swaggerParamsList); String actiondesc = action.comment(); - if (action.rpconly()) { + if (action.rpcOnly()) { actiondesc = "[Only for RPC API] " + actiondesc; } swaggerOperatMap.put("responses", Utility.ofMap("200", Utility.ofMap("description", actiondesc, "content", Utility.ofMap("application/json", respMap)))); diff --git a/src/main/java/org/redkale/boot/Application.java b/src/main/java/org/redkale/boot/Application.java index 8eaae689c..d2abb28e9 100644 --- a/src/main/java/org/redkale/boot/Application.java +++ b/src/main/java/org/redkale/boot/Application.java @@ -2547,7 +2547,7 @@ public final class Application { + " restart restart one process\r\n" + " --conf-file=[file] application config file, eg. application.xml、application.properties\r\n" + " apidoc generate apidoc\r\n" - + " --api-skiprpc=[true|false] skip @RestService(rpconly=true) service or @RestMapping(rpconly=true) method, default is true\r\n" + + " --api-skiprpc=[true|false] skip @RestService(rpcOnly=true) service or @RestMapping(rpcOnly=true) method, default is true\r\n" + " --api-host=[url] api root url, default is http://localhost\r\n" + " help, -h, --help show this help\r\n"; } diff --git a/src/main/java/org/redkale/net/http/HttpMapping.java b/src/main/java/org/redkale/net/http/HttpMapping.java index a275836af..fbbf99f9e 100644 --- a/src/main/java/org/redkale/net/http/HttpMapping.java +++ b/src/main/java/org/redkale/net/http/HttpMapping.java @@ -58,7 +58,7 @@ public @interface HttpMapping { * * @return 默认false */ - boolean rpconly() default false; + boolean rpcOnly() default false; /** * 是否鉴权,默认需要鉴权
diff --git a/src/main/java/org/redkale/net/http/HttpServlet.java b/src/main/java/org/redkale/net/http/HttpServlet.java index e5941f236..b3a15dc27 100644 --- a/src/main/java/org/redkale/net/http/HttpServlet.java +++ b/src/main/java/org/redkale/net/http/HttpServlet.java @@ -55,7 +55,7 @@ public class HttpServlet extends Servlet @Override public void execute(HttpRequest request, HttpResponse response) throws IOException { ActionEntry entry = request.actionEntry; - if (entry.rpconly) { + if (entry.rpcOnly) { if (!request.rpc) { finish404(request, response); return; @@ -387,19 +387,19 @@ public class HttpServlet extends Servlet protected static final class ActionEntry { ActionEntry(int moduleid, int actionid, String name, String[] methods, Method method, HttpServlet servlet) { - this(moduleid, actionid, name, methods, method, rpconly(method), auth(method), cacheSeconds(method), servlet); + this(moduleid, actionid, name, methods, method, rpcOnly(method), auth(method), cacheSeconds(method), servlet); this.annotations = annotations(method); } //供Rest类使用,参数不能随便更改 - public ActionEntry(int moduleid, int actionid, String name, String[] methods, Method method, boolean rpconly, boolean auth, int cacheSeconds, HttpServlet servlet) { + public ActionEntry(int moduleid, int actionid, String name, String[] methods, Method method, boolean rpcOnly, boolean auth, int cacheSeconds, HttpServlet servlet) { this.moduleid = moduleid; this.actionid = actionid; this.name = name; this.methods = methods; this.method = method; //rest构建会为null this.servlet = servlet; - this.rpconly = rpconly; + this.rpcOnly = rpcOnly; this.auth = auth; this.cacheSeconds = cacheSeconds; if (Utility.contains(name, '*', '{', '[', '(', '|', '^', '$', '+', '?', '\\') || name.endsWith("/")) { //是否是正则表达式 @@ -432,9 +432,9 @@ public class HttpServlet extends Servlet return mapping == null || mapping.auth(); } - protected static boolean rpconly(Method method) { + protected static boolean rpcOnly(Method method) { HttpMapping mapping = method.getAnnotation(HttpMapping.class); - return mapping == null || mapping.rpconly(); + return mapping == null || mapping.rpcOnly(); } protected static int cacheSeconds(Method method) { @@ -467,7 +467,7 @@ public class HttpServlet extends Servlet final int cacheSeconds; - final boolean rpconly; + final boolean rpcOnly; final boolean nonBlocking; diff --git a/src/main/java/org/redkale/net/http/Rest.java b/src/main/java/org/redkale/net/http/Rest.java index a92af0dd2..367ccca61 100644 --- a/src/main/java/org/redkale/net/http/Rest.java +++ b/src/main/java/org/redkale/net/http/Rest.java @@ -1128,7 +1128,7 @@ public final class Rest { if (controller != null && controller.ignore()) { throw new RestException(serviceType + " is ignore Rest Service Class"); //标记为ignore=true不创建Servlet } - final boolean serRpcOnly = controller != null && controller.rpconly(); + final boolean serRpcOnly = controller != null && controller.rpcOnly(); final Boolean parentNonBlocking = parentNon0; ClassLoader loader = classLoader == null ? Thread.currentThread().getContextClassLoader() : classLoader; @@ -1207,7 +1207,7 @@ public final class Rest { } RestMapping[] mappings = method.getAnnotationsByType(RestMapping.class); - if (!controller.automapping() && mappings.length < 1) { + if (!controller.autoMapping() && mappings.length < 1) { continue; } boolean ignore = false; @@ -1706,7 +1706,7 @@ public final class Rest { } RestMapping[] mappings = method.getAnnotationsByType(RestMapping.class); - if (!controller.automapping() && mappings.length < 1) { + if (!controller.autoMapping() && mappings.length < 1) { continue; } boolean ignore = false; @@ -1889,7 +1889,7 @@ public final class Rest { if ((rcs != null && rcs.length > 0) || (rcc != null && rcc.length > 0)) { restConverts.add(new Object[]{rcs, rcc}); } - if (dynsimple && entry.rpconly) { //需要读取http header + if (dynsimple && entry.rpcOnly) { //需要读取http header dynsimple = false; } @@ -2278,7 +2278,7 @@ public final class Rest { av0.visit("url", url); av0.visit("name", (defmodulename.isEmpty() ? "" : (defmodulename + "_")) + entry.name); av0.visit("example", entry.example); - av0.visit("rpconly", entry.rpconly); + av0.visit("rpcOnly", entry.rpcOnly); av0.visit("auth", entry.auth); av0.visit("cacheSeconds", entry.cacheSeconds); av0.visit("actionid", entry.actionid); @@ -2314,7 +2314,7 @@ public final class Rest { av0.visitEnd(); mappingMap.put("url", url); - mappingMap.put("rpconly", entry.rpconly); + mappingMap.put("rpcOnly", entry.rpcOnly); mappingMap.put("auth", entry.auth); mappingMap.put("cacheSeconds", entry.cacheSeconds); mappingMap.put("actionid", entry.actionid); @@ -3417,7 +3417,7 @@ public final class Rest { mv.visitInsn(AASTORE); } mv.visitInsn(ACONST_NULL); //method - mv.visitInsn(entry.rpconly ? ICONST_1 : ICONST_0); //rpconly + mv.visitInsn(entry.rpcOnly ? ICONST_1 : ICONST_0); //rpcOnly mv.visitInsn(entry.auth ? ICONST_1 : ICONST_0); //auth Asms.visitInsn(mv, entry.cacheSeconds); //cacheSeconds mv.visitTypeInsn(NEW, newDynName + "$" + entry.newActionClassName); @@ -3736,7 +3736,7 @@ public final class Rest { this.mappingMethod = method; this.methods = mapping.methods(); this.auth = mapping.auth(); - this.rpconly = serRpcOnly || mapping.rpconly(); + this.rpcOnly = serRpcOnly || mapping.rpcOnly(); this.actionid = mapping.actionid(); this.cacheSeconds = mapping.cacheSeconds(); this.comment = mapping.comment(); @@ -3790,7 +3790,7 @@ public final class Rest { public final boolean nonBlocking; - public final boolean rpconly; + public final boolean rpcOnly; public final boolean auth; diff --git a/src/main/java/org/redkale/net/http/RestMapping.java b/src/main/java/org/redkale/net/http/RestMapping.java index a8bd83ac8..35b8d73d0 100644 --- a/src/main/java/org/redkale/net/http/RestMapping.java +++ b/src/main/java/org/redkale/net/http/RestMapping.java @@ -46,11 +46,11 @@ public @interface RestMapping { String comment() default ""; /** - * 是否只接收RPC请求, 对应@HttpMapping.rpconly + * 是否只接收RPC请求, 对应@HttpMapping.rpcOnly * * @return boolean */ - boolean rpconly() default false; + boolean rpcOnly() default false; /** * 是否鉴权,默认需要鉴权, 对应@HttpMapping.auth diff --git a/src/main/java/org/redkale/net/http/RestService.java b/src/main/java/org/redkale/net/http/RestService.java index 20c7bdafc..d6421ac62 100644 --- a/src/main/java/org/redkale/net/http/RestService.java +++ b/src/main/java/org/redkale/net/http/RestService.java @@ -44,18 +44,18 @@ public @interface RestService { int moduleid() default 0; /** - * 是否只接受RPC请求, 默认为false, 为true则覆盖所有@RestMapping的方法的rpconly值,都转为true + * 是否只接受RPC请求, 默认为false, 为true则覆盖所有@RestMapping的方法的rpcOnly值,都转为true * * @return 默认false */ - boolean rpconly() default false; + boolean rpcOnly() default false; /** * 没有标记@RestMapping的方法是否转换, 默认为false * * @return 默认false */ - boolean automapping() default false; + boolean autoMapping() default false; /** * 是否屏蔽该类的转换 diff --git a/src/test/java/org/redkale/test/http/RestSleepService.java b/src/test/java/org/redkale/test/http/RestSleepService.java index 38b100aeb..70def0d15 100644 --- a/src/test/java/org/redkale/test/http/RestSleepService.java +++ b/src/test/java/org/redkale/test/http/RestSleepService.java @@ -11,7 +11,7 @@ import org.redkale.util.Utility; * * @author zhangjx */ -@RestService(name = "test", automapping = true) +@RestService(name = "test", autoMapping = true) public class RestSleepService extends AbstractService { public String sleep200() { diff --git a/src/test/java/org/redkale/test/rest/HelloService.java b/src/test/java/org/redkale/test/rest/HelloService.java index c229c6a06..d7ac742d7 100644 --- a/src/test/java/org/redkale/test/rest/HelloService.java +++ b/src/test/java/org/redkale/test/rest/HelloService.java @@ -19,7 +19,7 @@ import org.redkale.util.*; * HelloBean: Hello模块实现FilterBean的过滤Bean类 * */ -@RestService(automapping = true) +@RestService(autoMapping = true) public class HelloService implements Service { private int nodeid; diff --git a/src/test/java/org/redkale/test/rest/HelloService2.java b/src/test/java/org/redkale/test/rest/HelloService2.java index a6643affb..6b0c78b9c 100644 --- a/src/test/java/org/redkale/test/rest/HelloService2.java +++ b/src/test/java/org/redkale/test/rest/HelloService2.java @@ -19,7 +19,7 @@ import org.redkale.util.Sheet; * HelloBean: Hello模块实现FilterBean的过滤Bean类 * */ -@RestService(name = "hello", moduleid = 0, automapping = true, repair = true, ignore = false, comment = "Hello服务模块") +@RestService(name = "hello", moduleid = 0, autoMapping = true, repair = true, ignore = false, comment = "Hello服务模块") public class HelloService2 implements Service { @Resource